DMax criteria

gagetpro

New member
Local time
Yesterday, 23:12
Joined
Aug 10, 2007
Messages
9
Hello-

I am trying to set the default value of a forms text box to the max value in a table. I can’t seem to get the code right

Code:
Me!txtReceiptNumber.DefaultValue = DMax("[ReceiptSlipNumber]", "M_ReceiptSlip"), "[ReceiptSlipSites_IDs] = cboSites_IDs")

Where 
txtReceiptNumber is text box on form F_ReceiptSlip
cboSites_IDs      is combo box on form F_RceiptSlip

ReceiptSlipSites_IDs is field in table M_ReceiptSlip

The Dmax finds the max value in the table and seems to be ignoring the criteria.

Thanks for any help.
 
Me!txtReceiptNumber.DefaultValue = DMax("[ReceiptSlipNumber]", "M_ReceiptSlip"), "[ReceiptSlipSites_IDs] =" & Me!cboSites_IDs)
 
Yes! But must remove the extra paranthesis

Me!txtReceiptNumber.DefaultValue = DMax("[ReceiptSlipNumber]", "M_ReceiptSlip", "[ReceiptSlipSites_IDs] =" & Me!cboSites_IDs)


Thanks
 

Users who are viewing this thread

Back
Top Bottom