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

Action based on a value in an unbound table 1

Status
Not open for further replies.

reg999

Technical User
Jan 17, 2005
37
US
...need help coding this, I'm very new to VBA coding.

I have a button control on a form that needs to perform an action based on the value of a field in a table that is not bound to the form.

Access table name is "Match" field name is "Mtc" (Text field). All values in the "Mtc" field are the same (expected value is "3StateD1").

How do I refer to the table/field, and write the If?

If xxxxxxxxx Then
DoCmd.OpenForm "test"
Else
DoCmd.DeleteObject acTable, "Match"
End If

Thank you,
Reg999
 
Have a look at the DLookUp function:
If DLookUp("Mtc", "Match") = "3StateD1" Then

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
ahhhhh... how the simple solution eludes me...

Thank you, once again, PHV

I had <U>really</U> tried to make that more difficult...
Reg999

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top