0
votes

I am trying to set up a macro and expression to update a form field when an existing record is selected in a different field. Specifically I have a drop down on my form that allows the user to select a "request" object from my request table. When they select it, it automatically fills the projCourseID field with the corresponding reqCourseID from the request object.

The way I have it set up now is to run a SetProperty macro AfterUpdate on the reqID dropdown. I have the macro filled out like this:

Control Name: projCourseID
Property: Value
Value =DLookUp("[reqCourseID]","Training Requests","[reqID] =" & [Forms]![New Project]![reqID])

reqID is the primary key to Training Requests table. When I try to run this I get a 2950 error. I feel like I am missing something small and obvious. Wjat am I doing wrong?

1

1 Answers

0
votes

If other things are okay, I think you are missing Single Quote (') in criteria part. see below expression.

Value =DLookUp("[reqCourseID]","Training Requests","[reqID] ='" & [Forms]![New Project]![reqID] & "'")

Remember in DLookUP function criteria use variant data type. So, you have to use Single Quote (')