Manually entering data to a record

zooto68

New member
Local time
Today, 07:42
Joined
Sep 7, 2005
Messages
6
Hi,

I am new to access programming. I want to do the following but don't know how :-

I have a form which is full of text boxes for people to enter data. I want them to enter the relevant data into those textbox's and then to click a SAVE button. Only when the SAVE button is pressed do I want the contents of the text boxes to go into the relevant fields in a table, i.e. they are all unbound.

Can anyone tell me how this is done please and possibly give an example code?

Thanks
 
Bind them; it's a feature of Access.

You can use the BeforeUpdate event of the form to prevent anything from saving, if you enter the code Cancel = True in the form's module.
 
As I said, I'm new to access so can you clarify what you mean please as I still don't understand?

I didn't want the boxes bound. I wanted it that the data only goes into the table if the user clicks a SAVE button, any other button, i.e. move onto next record or whatever, will not save anything typed into the table. If they are bound then whatever is in them will go into the record.
 
zooto68 said:
As I said, I'm new to access so can you clarify what you mean please as I still don't understand?

I didn't want the boxes bound. I wanted it that the data only goes into the table if the user clicks a SAVE button, any other button, i.e. move onto next record or whatever, will not save anything typed into the table. If they are bound then whatever is in them will go into the record.

First, please don't post the same question multiple times. It's a waste of others' time.

Right, as you've said, you are a new user, so bind them as you would any query to a form. Note, that I said query and not table. Make queries of your tables if you have not done so already.

I'd advise you to ditch the save button and do it the way others would, which is simply to ask the user if they wish to save their changes when the form is closed. If they say yes, then it saves them; otherwise, no changes are saved.

Thus, in the Code Builder option of the BeforeUpdate event:

Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
    If MsgBox("Do you want to save the changes?", vbQuestion + vbYesNo, "Save Changes?") = vbNo Then
        Me.Undo
    End If
End Sub
 
Apologies for posting it in several forum headings, but wasn;t sure which one it went in.

Thanks
 

Users who are viewing this thread

Back
Top Bottom