SteveL13
asked on
Trying to populate a text field on a form with a DLookup
I'm using this code in the control source property of a textbox on a form and all I get is #Name?
The form is a datasheet view form if that matters.
--Steve
The form is a datasheet view form if that matters.
--Steve
ASKER
Sorry... Forgot to paste it...
=DLookUp("[FullName]","tbl Personnel" ,"[ID] = " & [Forms]![subfrmIssueDS]![t xtOpenedBy ])
=DLookUp("[FullName]","tbl
If [FullName] is a Text field in your table then this should work ...
=DLookUp("[FullName]","tbl Personnel" ,"[ID] = '" & [Forms]![subfrmIssueDS]![t xtOpenedBy ] & "'")
ET
=DLookUp("[FullName]","tbl
ET
ASKER
FullName is text but ID is a number
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Still not working. I'll have to strip sensitive "stuff" out and attach a database.
ASKER
Sample attached. The problem is with the form... frmIssueDSheader
(Plus the search "thing" isn't working but that's another issue).
Example.accdb
(Plus the search "thing" isn't working but that's another issue).
Example.accdb
This works in the OpenedBy box in your subform:
=Nz(DLookUp("FullName","tb lPersonnel ","ID =" & [txtOpenedByN]),"No Value")
This works in the txtAssignedTo box in your subform:
=Nz(DLookUp("FullName","tb lPersonnel ","ID= " & [cboAssignedTo]),"No Value")
That said - you could just join tblPersonnel to tblIssues (twice), and use the values from there, instead of using a DLookup. I made those changes in the file and uploaded.
I'd also caution you against setting up combos and such on columns at the table level. There is absolutely no good reason to do so, and lots of very good reasons to NOT do so.
Example--1-.accdb
=Nz(DLookUp("FullName","tb
This works in the txtAssignedTo box in your subform:
=Nz(DLookUp("FullName","tb
That said - you could just join tblPersonnel to tblIssues (twice), and use the values from there, instead of using a DLookup. I made those changes in the file and uploaded.
I'd also caution you against setting up combos and such on columns at the table level. There is absolutely no good reason to do so, and lots of very good reasons to NOT do so.
Example--1-.accdb
I can't download the .accdb due to an IE error but #Nameis often caused because the control name is the name of a column in the form's RecordSource but the controlSource contains an expression (anything that starts with =) rather than the name of the bound column.
When you let a wizard build a form/report or when you drag a field on to a form/report from the field list, Access Assigns the ControlName to be the same as the ControlSource. So if the column in the table/query is DeptName, then the ControlSource ends up being DeptName and so does the ControlName. If you then change ControlSource to something like =[DeptNum] & " - " & [DeptName], you will get the #Name error.
When you let a wizard build a form/report or when you drag a field on to a form/report from the field list, Access Assigns the ControlName to be the same as the ControlSource. So if the column in the table/query is DeptName, then the ControlSource ends up being DeptName and so does the ControlName. If you then change ControlSource to something like =[DeptNum] & " - " & [DeptName], you will get the #Name error.
Sorry, I misread your Dlookup statement ... I thought you were looking for FullName.
ET
ET
etsherman: That was the one I uploaded, after fixing the DLookup issue.
Ok .... Thanks
Jim.