Error msg for opening report

zariazakeryzavien05

New member
Local time
Today, 05:30
Joined
Jul 22, 2009
Messages
2
I am using the where condition when opening a report. I am using referring to the control in order to pass the criteria, but get a msg that says incorrect data type. It is a text field with info like this (00166), but it works fine when I hard code it. Example below.

docmd.open report , me.openarg,,"[UIC]=" & forms!frmSelectionSite!cmbSite.column(1) (this doesn't, but once I debug, value for forms!frmSelectionSite!cmbSite.column(1) shows 00166)

docmd.open report , me.openarg,,"[UIC]='00166'" (this works)
 
As you did when you hard coded it, you need single quotes around the value:

docmd.open report , me.openarg,,"[UIC]='" & forms!frmSelectionSite!cmbSite.column(1) & "'"
 

Users who are viewing this thread

Back
Top Bottom