data entry

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

Guest

I would like to fill a txt box with a formula determined by another fields data
what expression would i need to code for example the field name is category
and the data acronyms are LS, LS+ or FS
If the data is LS+ i want the txt to display 40-50
 
robb said:
I would like to fill a txt box with a formula determined by another fields data
what expression would i need to code for example the field name is category
and the data acronyms are LS, LS+ or FS
If the data is LS+ i want the txt to display 40-50


Something like this should work just fine. Change to fit your syntax :

Sub Category_AfterUpdate()

Select Case Category
Case "LS"
txtField = "Whatever"
Case "LS+"
txtField = "40-50"
Case "FS"
txtField = "Something Else"
Case Else
MsgBox "Error Message Here"
End Select
End Sub
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access
 
Thanks for the reply
Im relatively new to this so two more questions...
was my original question descriptive enough? and
Do I write the code into the txt box control properties?
thanks again
 
Good enough for me to understand. It might have been better to give the
names of all the controls that are affected. I used txtField for the result
since I didn't know the name.

Put the code in the AfterUpdate event. Click on the Event tab in the form's
property sheet (in Design View) Double-Click in the AfterUpdate event box.
It should change to read: [Event Procedure]

Now click on the ellipses button (...) that appears at the end of that line.
You'll be taken to a code stub which will allow you to paste the body of the
code in. Change the controlnames to those of your controls, and the values
to whatever you wish. That's it!
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access
 
thanks again for the help

Arvin Meyer said:
Good enough for me to understand. It might have been better to give the
names of all the controls that are affected. I used txtField for the result
since I didn't know the name.

Put the code in the AfterUpdate event. Click on the Event tab in the form's
property sheet (in Design View) Double-Click in the AfterUpdate event box.
It should change to read: [Event Procedure]

Now click on the ellipses button (...) that appears at the end of that line.
You'll be taken to a code stub which will allow you to paste the body of the
code in. Change the controlnames to those of your controls, and the values
to whatever you wish. That's it!
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access

robb said:
Thanks for the reply
Im relatively new to this so two more questions...
was my original question descriptive enough? and
Do I write the code into the txt box control properties?
thanks again
 
Back
Top