Access Form Submit Button

  • Thread starter Thread starter Chris Durant via AccessMonster.com
  • Start date Start date
C

Chris Durant via AccessMonster.com

Morning All,

I have a 'Team Change Database' that is used to process amendments to thew
staffing data we hold. On previous forms that i have built i linked the form
to the table using control sources. But i have found that this sometimes
creates blank records in the table where people input the wrong thing or
start an entry and then close the form etc. I am looking for a way around
this ? ? ?
In the past i have used a method whereby i pull the original record from the
table into a holding table and then use an update query from the form
fieldsto update the record. This unfortunately is not possible in this case.
I did try append but this only works if there is already a record in the
table.

Im not sure if this makes any sense but basically i am looking for a submit
button that actually submits the data from the form.

Any help (as always) would be greatly appreciated.

Many thanks in advance for any time taken on this problem.

Regards

EddiesVoicebox
 
Is the one field in that should always be filled in? If so, open the table
in design view, select the field, and set the Required property to Yes in
the lower pane. This will prevent Access saving a completely blank record.

If you need more powerful validation of the record before it is saved, use
the Before Update event of the form. Access triggers this event for you to
run your record-level checks, and you can cancel the event if the record
should not be saved. This kind of thing:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(Me.Surname) Then
Cancel = True
MsgBox "Enter a surname."
End If
if Me.EndDate < Me.StartDate Then
Cancel = True
MsgBox "End date cannot be before Start date."
End If
End Sub

While it is possible to create a submit button what it has to do is cancel
Form_BeforeUpdate. That's the only way to prevent the save that could be
triggered by a keypress (Shift+Enter), menu (Records | Save Record), toolbar
button (if present), or by closing the form, applying a filter, altering the
sort order, closing Access, clicking a navigation button, or triggering any
other event that requires the record to be saved.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

message
news:[email protected]...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top