DLookup Method with subform

B

BobT

I am performing a valdidation rule on a field on a subform in the form of:

DLookup("[Invoice #]","Query1","[amt] = &" Form.subform.control)

This is with Access 97. What is the syntax to refer to the control on the
subform when using DLookup?

Thanks,
 
B

BobT

Well I still seem to have an auomation error. The exact syntax I am using is:

=DLookUp("[Rev Amt]","[InvoiceTotalCompareforPayments]","[Invoice #] =" &
[Forms]![Payment Test 500].[Payments Subform2].[Invoice #])

Within the control named "rev amt"of the subform named "payments subform2"
the above is set for the validation rule. Where "rev amt" in query
invoicetotalcompareforpayments is queried where invoice # in query matches
invoice number entered in the subform above.
--
BT


roger said:
Forms!Myform.MySUBForm.Form.Mycontrol


BobT said:
I am performing a valdidation rule on a field on a subform in the form of:

DLookup("[Invoice #]","Query1","[amt] = &" Form.subform.control)

This is with Access 97. What is the syntax to refer to the control on the
subform when using DLookup?

Thanks,
 
R

roger

1. you don't need [brackets] in VB (qeries and forms yes but not VB)
2. you forgot .FORM. between subform name and control name
3. I don't think you can name a field with a #.
try renaming that field "InvoiceNo"

so you should have:
=DLookUp("Rev Amt","InvoiceTotalCompareforPayments","InvoiceNO =" &
Forms!Payment Test 500.Payments Subform2.FORM.InvoiceNO

hth
BobT said:
Well I still seem to have an auomation error. The exact syntax I am using is:

=DLookUp("[Rev Amt]","[InvoiceTotalCompareforPayments]","[Invoice #] =" &
[Forms]![Payment Test 500].[Payments Subform2].[Invoice #])

Within the control named "rev amt"of the subform named "payments subform2"
the above is set for the validation rule. Where "rev amt" in query
invoicetotalcompareforpayments is queried where invoice # in query matches
invoice number entered in the subform above.
--
BT


roger said:
Forms!Myform.MySUBForm.Form.Mycontrol


BobT said:
I am performing a valdidation rule on a field on a subform in the form of:

DLookup("[Invoice #]","Query1","[amt] = &" Form.subform.control)

This is with Access 97. What is the syntax to refer to the control on the
subform when using DLookup?

Thanks,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top