DLookUp not working properly in Microsoft Access

67 Views Asked by At

Trying to pull the value in the Query to populate Form Field, not working with what I've tried.

Table 1: Quote Data

Fields: Quote #, Part #, CNC Hours

Table 2: Rate Chart

Fields: Rate Type, Cost ($)

Query 1: Cost of CNC

Fields: Quote #, Part #, CNC Hours, Parts Per Mag, Rate Type (Criteria: "3D Shop"), Cost ($)

Expression: Cost of CNC= [CNC Hours]*[Cost ($)]/[Parts Per Mag]

Main Form: Generate Quotes

SubForm: Quote Data Subform

Field Box: CNC $

Control Source: =DLookUp("[Cost of CNC]", "[Cost of CNC]", "[Part #]=" & [Forms]![Cost of CNC Subform]![Part #])

With the above Control Source I keep getting #Name? in the field text box CNC $.

I've also tried:

=DLookUp("[Cost of CNC]", "[Cost of CNC]", "[Part #] = " & [Part #]) but I get #Error.

What am I doing wrong?

I want the value in Cost of CNC (associated with the proper Part #) to populate Form Field: CNC $.

1

There are 1 best solutions below

0
Rose Lavoie On

I got the following to work:

=DLookUp("[Cost of CNC]", "[Cost of CNC]", "[Part #]='"&[Part #]& "'")