Form Events

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I was wondering if there is a way to change what is inserted when a new
record is inserted on from a form. What I want to do is when a new record is
created on the form I would like to change a field (bound to the table) to a
default value, but not show it to the user. Thanks.
 
You could put logic into the form's BeforeInsert event. However, what's the
point of having input that the user can't see? Why not just make the field
hidden on the form?
 
Go to your underlying table and under the field enter the Default Value you
want! It'll be inserted automatically when a new record is created! No need
to expose it to the form's user!

Good Luck!
 
The field was going to be hidden because it was a customer id from another
form and I saw no reason to display it to the user. I did find a solution
though. I added a textbox bound to customerid that had visible = false.
Then I used the before insert event to set the customerid textbox to the
value on the parent form as below:

Private Sub Form_BeforeInsert(Cancel As Integer)
Me!CustomerID = Forms![Choose Customer].Combo6.Value
End Sub

Thanks for the help.
 
Back
Top