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

Invalid argument in DMax function

Status
Not open for further replies.

grgimpy

Programmer
Nov 1, 2006
124
US
I keep getting an "invalid argument in domain aggregate function" error when my form goes through this code. The code works fine if I don't use the variable QueryName, but it would be a lot easier to code if I could.

I suspect there is either something wrong with my Dim QueryName or I need to write the DMax function differently if using a variable.

Thanks for any help!

Code:
Dim QueryName
Dim Lookup1, Lookup2, a, b As Variant
QueryName = "Ni-Au-CooperSubformQuery"
Lookup1 = DMax("[ID]", QueryName)
Lookup2 = DMax("[ID]", QueryName) - 1
a = DLookup("[Ni-Au-Soft Gold Thickness Avg]", QueryName, "[ID]=" & Lookup1)
b = DLookup("[Ni-Au-Soft Gold Thickness Avg]", QueryName, "[ID]=" & Lookup2)
 
Have you tried this ?
QueryName = "[Ni-Au-CooperSubformQuery]"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
that worked, thanks. it's weird though b/c i tried fixing it that way, so i thought, before, but it didnt' do anything. hopefully the error will stay away now. thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top