Form to insert to table

rhernand

Registered User.
Local time
Today, 03:22
Joined
Mar 28, 2003
Messages
96
I have a Form that I use to insert records to a table. The STATE field is not on the Form, but needs to be populated on the table based on the TOWNCODE field that is on the Form. If the TOWNCODE entered on the Form is > 20 then the STATE is 2, else the STATE is 1. How can I do this?
 
I would add the STATE field onto the form as a textbox (txtState) and set the visible property to 'No' if you don;t want it to be seen by the user.

Then, in the after-update event of the TOWNCODE control (cmboTowncode) put something like:

Select Case Nz(Me.cmboTowncode,0)
Case 0
'what do you want to do if they clear the Towncode value?
Me.txtState = Null
Case Is < 20
Me.txtState = 2
Case Is >= 20
ME.txtState = 1
Case Else
Me.txtState = Null
End Select
 
Worked Great Thanks

Worked Great Thanks
 

Users who are viewing this thread

Back
Top Bottom