View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Writing data back via a userform

Is there a unique field in the database that uniquely identifies the record.

If so, then the simplest approach would be to check if the record being
entered exists or not. If it exists, update it. If not write it to the
bottom. then you would only need one button on your worksheet and one
userform.

--
Regards,
Tom Ogilvy

"Steph" wrote in message
...
Hi everyone. I created a pretty large userform. I then created 2 buttons
on the Excel worksheet that calls the Userform- one for a New entry,

andone
for an edit to an existing entry. The form has an "Enter" button that
initates the writing to the database.

The way I have it set up now, both buttons (edit and new) call the same
userform. Ideally, I would like the following pseudo-code:

If the New button is pushed, call Userform1, and when "Enter" is pushed
write data entered to the bottom of the database,

Else if Edit button is pushed, call Userform1, and when "Enter" is pushed
write data back to the row that was edited.

I don't know if this can be done without creating an entirely new

userform,
or at least another "Enter" button. But I'd like to simply use the 1 form
and 1 enter botton. Can you help?