nelslynn
12-11-2001, 01:06 PM
PLEASE, can anyone help!!!
How do you assign a unbound text box on a form to a single value a query provides. I am doing this in the textbox's GotFocus event. THink I need the VBA code.
Thanks.
Jack Cowley
12-11-2001, 02:21 PM
Take a look at the DLookup function in Help.
nelslynn
12-12-2001, 07:36 AM
Okay, here is my DLook up statement...
DLookup("[cCommission]", "tblCommission", "[cBrokerCode] = '" & Me.cboAcctNo & "' and [cSecurityType] = '" & Me.cboSecurity & "'")
I have tried this in the Control Source of the text box and also put it in the Click Event. It is capturing the values on the form just fine, but the result gives me a null.
Can anyone see where I am going wrong?
Jack Cowley
12-12-2001, 08:07 AM
Does the code look like this for the Control Source?
=DLookup("[cCommission]", "tblCommission", "[cBrokerCode] = '" & Me.cboAcctNo & "' and [cSecurityType] = '" & Me.cboSecurity & "'")
Is cBrokerCode a number or text? What about cSecurityType?
If cBrokerCode is numeric then try this:
=DLookup("[cCommission]", "tblCommission", "[cBrokerCode] = " & Me.cboAcctNo & " and [cSecurityType] = '" & Me.cboSecurity & "'")
If both numeric then try this:
DLookup("[cCommission]", "tblCommission", "[cBrokerCode] = " & Me.cboAcctNo & " and [cSecurityType] = " & Me.cboSecurity)
nelslynn
12-12-2001, 08:40 AM
Yes, the code in the control source includes the "=". cBrokerCode and cSecurityType are NON-numberic data, but I want the DLookup to return a numeric.