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!

DLookup Correct syntax for *5 1

Status
Not open for further replies.

meagain

MIS
Nov 27, 2001
112
CA
Hi,

I have a form which runs the following code on opening:

If DLookup("RUNS_LEFT", "SD_TRACKER", "[KEY] = 1") = 0 Then
DoCmd.RunMacro "ABC"

Else

DoCmd.RunMacro "RESUME AFTERHOURS"
End If


I need to change this so it runs macro "ABC" whenever the number in the "Runs Left" field ends in 0 or 5. I don't know what to replace "=0" with to get the correct result.

Your help would greatly be appreciated.

Thanks,
LP
 
If DLookup("RUNS_LEFT", "SD_TRACKER", "[KEY] = 1") = 0 OR DLookup("RUNS_LEFT", "SD_TRACKER", "[KEY] = 1") = 5 Then
 
If (DLookup("RUNS_LEFT", "SD_TRACKER", "[KEY] = 1") MOD 5) = 0 Then

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Hi,

Thanks for your response. I think I need to elaborate further. The "Runs left" field will contain a number from 220 to 0, which descends by 1 every 3-5 minutes. When the "Runs left" field contains a number ending in 0 or 5 (ie:215, 210, 150, 135), I'm going to have it run another routine. If I were doing a query I would use Like *5 for instance or right([field],1)=5. I think (although I could totally be off base), that I need something similar in my code for Access to understand the number in the field must end with 0 or 5.

Any thoughts?

Thanks,
LP
 
Did you even try my suggestion ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Yes, but after your response, I reviewed and realized I entered it incorrectly.

Gotta tell you, this is brilliant, and it has opened my eyes to a few more nifty solutions I'll be able to whip up.

Thanks so much PHV....whoever you are [thumbsup2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top