Data saving to table

RyanB

Registered User.
Local time
Today, 21:56
Joined
Jul 13, 2004
Messages
53
Hi all,

On my form when you fill in the fields and close the form down it saves the record, should this be? This will create problems for my database as user's will only half fill in information, how can I make it so that the data is only saved to the table when a button is pressed?

Thanks heaps!

Ryan.
 
Actually, it is better to change the table definition so that required fields are marked as required. That way, they cannot accidentally be saved.

Rather than relying on a button press, I would use the BeforeUpdate event of the form to prevent an incomplete record from being saved.

If IsNull(Me.SomeField) Then
msgbox "some field is required",vbokonly
Cancel = True
Me.SomeField.SetFocus
End If

This if statement cancels the pending update so the record will not be saved and repositions the cursor at the empty field. Add as many if statements as you need. Or if you have changed the table definition to require, required fields, then add error handling so that you can substitute your own error message.
 
I think I understand you.

What if all my fields are not required tho? It is possible that on my form that some of the fields will not need to be filled in sometimes.

Does anybody have a link to information on error handling and how to set it up.

Wouldn't a submit button me better so it saves what ever they have done when its finished?

I'm fairly newb so I could be wrong.

Cheers,

Ryan.
 
If you decide to have a button to save the record then you will also need one to cancel the pending save, and just incase somebody forgets to click on one of these you will need to have code in the BeforeUpdate event to ask what action to take and then take the appropriate action.

Brian
 

Users who are viewing this thread

Back
Top Bottom