Assistance with Sintax

misslee1888

New member
Local time
Today, 19:55
Joined
Dec 2, 2002
Messages
98
I have a query for which I am trying to get the min date of the record in my subform.
I have done this and mamager to get the total for some of my other fields using:


Forms!frmSoftwareLicenseEntry1.TOTCOST = DSum("[TOTAL]", "QUERyCALC", "[QUERYCALC.SOFTWAREID] = " & [SoftwareID])

I have created a query called Querycalcinv

But I just can seem to get the syntax right. I have tried

Forms!frmSoftwareLicenseEntry1.nextdate = Min("[NEXTDATE]", "QUERyCALCINV", "[QUERYCALCINV.SOFTWAREID] = " & [SoftwareID])

but it doesnt seem to like it. Can anyone give me some assistance.
I have been at this for ages.
 
I can even get the min from the query, but just dont know the syntax to get it to dsiplay on the field on afterupdate. I just need to know the correct syntax.
 
You need to use DMin instead of just Min

Code:
X = DMin("FieldName","Domain","Condition")

David
 
i dont think you need to specify the query name again when looking up the field and if your search field is a numeric value then it should be ok, but if its a string then it should be in single quotes ie:

for numeric:
Forms!frmSoftwareLicenseEntry1.TOTCOST = DSum("[TOTAL]", "QUERyCALC", "[SOFTWAREID] = " & me.[SoftwareID])

for a string:
Forms!frmSoftwareLicenseEntry1.TOTCOST = DSum("[TOTAL]", "QUERyCALC", "[SOFTWAREID] = '" & me.[SoftwareID] & "'")


also this is assuming that [SofwareID] the search criteria exists on yr form.
 
Thanks for the replies Dcrakes. I tried that and it worked a dream. I cant believ hpw long I was working on this. Do most of the access procedures need D in front of them for VB.
 

Users who are viewing this thread

Back
Top Bottom