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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Code for setting a field value

Status
Not open for further replies.

DD999

IS-IT--Management
May 8, 2003
29
CA
This is really basic but I'd appreciate some help.

I have a table called tblDetails that has a field called QorA, which holds either the letter Q or the letter A (big surprise, eh?).

The field defaults to Q as per the table setup.

Whenever data is entered into that table using a certain form, I want the value entered into QorA to be the letter A, but I don't want to show this field on the form.

I was planning on using the AfterUpdate event for the form to have code set the value.

What is the proper code to do this?

tblDetails.QorA ="A" didn't work

Is there a good online reference for VBA???

Thanks.........Dan
 
Do you have a unique ID or value for each record in the table? If so this should work.

Docmd.RunSQL &quot;UPDATE tblDetails Set QorA = 'A' Where UniqueID = &quot; & <CurrentID>

<CurrentID> represents either a field on your form or a variable set to that value.

Hope this helps,

Shane
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top