Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Controlling a field from another field

Status
Not open for further replies.

matpj

Technical User
Mar 28, 2001
687
GB
I have a combo-box containing 5 different selections.
I also have a date field.

I need to be able to write the current date/time into the date field when the 'closed' optin is chosen from the combo-box field.

Please can anyone help, in basic steps - telling me what to type and where - as I am not much of a database programmer!

I appreciate your help

Matt
 
In the 'Before_Update' event of the combo box, compose something like...

If Me.cboMyComboBox = 'Closed' then
Me.txtMyDateField = Format(now(), "mm/dd/yyyy")
End if

The conditional compares the BoundColumn in your combo box with the 'Closed' value you specified. If 'Closed' was selected, then the today's date/time is formatted to the short date format and placed into the Textbox to hold the date.

If your combo box is bound to a number that corresponds to the 'Closed' value, then you will need to change the conditional IF statement to reflect the corresponding number.

Gary
gwinn7

 
Actually, that is 'BeforeUpdate' event. Oops!

Gary
gwinn7
 
thanks for the reply,
but I get a syntax error when I try to run the Before Update event.

I don't know much about the programming side of things, so I am not sure how to get to the right place ot enter code.
for this one I just double-clicked on the combo-box and chose [event procedure] and then clicked on the '...' button to enter the code you suggested.
Is this correct? cos I get the syntax error!

Matt
 
What is the error that you are getting. Did you change the names of the fields from Gary's post to match the names of the fields in your form? Terry M. Hoey
th3856@txmail.sbc.com
While I don't mind e-mail messages, please post all questions in these forums for the benefit of all members.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top