Dialog box with combobox selection getting an error (1 Viewer)

jleval

Registered User.
Local time
Today, 07:56
Joined
May 16, 2012
Messages
53
I have a dialog box that pops up to select a certain part number to print. In this dialog box is a combobox that has a list of my partnumbers. When I select a part number and hit the okay button I get this error:
Syntax error (missing operator) in query expression
Here is my code when I click the command button after selecting an item from the list

Dim strWhere As String

strWhere = Me.LookUpPartNumber 'name of combobox
DoCmd.OpenReport "Batch2", acViewPreview, , strWhere
DoCmd.Close acForm, "Batch", acSavePrompt
DoCmd.Close , "frmPrintDateRange"

What am I doing wrong?
 

Isskint

Slowly Developing
Local time
Today, 14:56
Joined
Apr 25, 2012
Messages
1,302
you are missing the object type in your close statement
 

jleval

Registered User.
Local time
Today, 07:56
Joined
May 16, 2012
Messages
53
thanks I got it to work, but I am having another problem. The partnumbers in my value box seem to be doubling and tripling each time a select something. How can I stop this
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 06:56
Joined
Aug 30, 2003
Messages
36,132
What is its row source? It would normally be a "parts" table that had only one record for each part.
 

jleval

Registered User.
Local time
Today, 07:56
Joined
May 16, 2012
Messages
53
Thanks, I got it to work. My row source was from a query, but I changed it. I guess it was giving me every instance of the part number where the tool was measured
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 06:56
Joined
Aug 30, 2003
Messages
36,132
Glad you got it sorted out.
 

Users who are viewing this thread

Top Bottom