Can DLookup Do This

C

Chuck B.

I found this on Dev Ashish's site.
------------------------------------------------------
Mix-n-Match

DLookup("FieldName", "TableName", "Criteria1 = " &
Forms!FormName!Control1 & " AND Criteria2 = '" & Forms!
FormName!Control2 & "'" & " AND Criteria3 =#" & Forms!
FormName!Control3 & "#")
------------------------------------------------------

Can the dlookup function be used to find VendorID when
specifying dept and date range criteria.

intSONum = DLookup("[VenID]", "[tblStandOrder]", "[Dept]
= '" & Forms!frmReports!cboDept & "'" And "[ExpDate]
Between #& [Forms]![frmReports]![txtBeginDate] &# "
And "#" & [Forms]![frmReports]![txtEndDate] & "#")

I am getting a type mismatch error. Any comments or
suggestions you have would be greatly appreciated.
 
M

Marshall Barton

Chuck said:
I found this on Dev Ashish's site.
------------------------------------------------------
Mix-n-Match

DLookup("FieldName", "TableName", "Criteria1 = " &
Forms!FormName!Control1 & " AND Criteria2 = '" & Forms!
FormName!Control2 & "'" & " AND Criteria3 =#" & Forms!
FormName!Control3 & "#")
------------------------------------------------------

Can the dlookup function be used to find VendorID when
specifying dept and date range criteria.

intSONum = DLookup("[VenID]", "[tblStandOrder]", "[Dept]
= '" & Forms!frmReports!cboDept & "'" And "[ExpDate]
Between #& [Forms]![frmReports]![txtBeginDate] &# "
And "#" & [Forms]![frmReports]![txtEndDate] & "#")

I am getting a type mismatch error. Any comments or
suggestions you have would be greatly appreciated.

Your quotes are out of whack.

DLookup("[VenID]", "[tblStandOrder]", "[Dept] = """ &
Forms!frmReports!cboDept & """ And [ExpDate] Between #" &
[Forms]![frmReports]![txtBeginDate] & "# And #" &
[Forms]![frmReports]![txtEndDate] & "#")
 
C

Chuck B.

Thanks, Marsh!
-----Original Message-----
Chuck said:
I found this on Dev Ashish's site.
------------------------------------------------------
Mix-n-Match

DLookup("FieldName", "TableName", "Criteria1 = " &
Forms!FormName!Control1 & " AND Criteria2 = '" & Forms!
FormName!Control2 & "'" & " AND Criteria3 =#" & Forms!
FormName!Control3 & "#")
------------------------------------------------------

Can the dlookup function be used to find VendorID when
specifying dept and date range criteria.

intSONum = DLookup("[VenID]", "[tblStandOrder]", "[Dept]
= '" & Forms!frmReports!cboDept & "'" And "[ExpDate]
Between #& [Forms]![frmReports]![txtBeginDate] &# "
And "#" & [Forms]![frmReports]![txtEndDate] & "#")

I am getting a type mismatch error. Any comments or
suggestions you have would be greatly appreciated.

Your quotes are out of whack.

DLookup("[VenID]", "[tblStandOrder]", "[Dept] = """ &
Forms!frmReports!cboDept & """ And [ExpDate] Between #" &
[Forms]![frmReports]![txtBeginDate] & "# And #" &
[Forms]![frmReports]![txtEndDate] & "#")
 
Top