okay here goes... my first post on a forum other than my uni site.
I am building (trying to anyway) an access db. I have a invoice form that is based on a table (invoice table) and I have a checkbox field in another table (customer table) that I need to get into the invoice form so that I can do some visislbe and enable stuff with other fields on the form based on whether the field in the customer table is checked or not.
I have tried the DLookup function as follows;
'check if the customer is a memeber
Dim varIsMember As Variant
varIsMember = DLookup("[Member]", "tblCustomer", "[CustomerNo] = "
& Me!CustomerNo)
varIsMember = DLookup("[Member]", "tblCustomer", "[CustomerNo] =" _
'& Forms![frmInvoiceNew]!CustomerNo)
' if the customer is a member then enable disount else disable discount field
If varIsMember = "0" Then
Forms!frmInvoiceNew.frmLineItemTotals.Form!DollarD iscountValue.Enabled = True
Else
Forms!frmInvoiceNew.frmLineItemTotals.Form!DollarD iscountValue = 0
Forms!frmInvoiceNew.frmLineItemTotals.Form!DollarD iscountValue.Enabled = False
End If
but I keep getting a Error 2001 previous action canceled.
I have spent all night (and I mean all night, 4.30am!) and still can't figure out what I am doing wrong.
Please help a strung out student.
Many thanks, j.
I am building (trying to anyway) an access db. I have a invoice form that is based on a table (invoice table) and I have a checkbox field in another table (customer table) that I need to get into the invoice form so that I can do some visislbe and enable stuff with other fields on the form based on whether the field in the customer table is checked or not.
I have tried the DLookup function as follows;
'check if the customer is a memeber
Dim varIsMember As Variant
varIsMember = DLookup("[Member]", "tblCustomer", "[CustomerNo] = "
& Me!CustomerNo)
varIsMember = DLookup("[Member]", "tblCustomer", "[CustomerNo] =" _
'& Forms![frmInvoiceNew]!CustomerNo)
' if the customer is a member then enable disount else disable discount field
If varIsMember = "0" Then
Forms!frmInvoiceNew.frmLineItemTotals.Form!DollarD iscountValue.Enabled = True
Else
Forms!frmInvoiceNew.frmLineItemTotals.Form!DollarD iscountValue = 0
Forms!frmInvoiceNew.frmLineItemTotals.Form!DollarD iscountValue.Enabled = False
End If
but I keep getting a Error 2001 previous action canceled.
I have spent all night (and I mean all night, 4.30am!) and still can't figure out what I am doing wrong.
Please help a strung out student.
Many thanks, j.
Last edited: