VBA Combo Box Problem

Thread Solved

Join Date: Sep 2006
Posts: 20
Reputation: saurabh_kanwar is an unknown quantity at this point 
Solved Threads: 0
saurabh_kanwar saurabh_kanwar is offline Offline
Newbie Poster

VBA Combo Box Problem

 
0
  #1
Oct 4th, 2006
Hi Guys,
I just need a bit of help in VBA.
What I'm trying to do is to open report from a form. The reports are based on Query.
The form consists of a combo box and a command button. What I want to do is to select the condition of opening the report from combo box and open that report.

Following is the code I'm using

1) Dealer = Form!DEALER_COMBO.Value

2) DoCmd.OpenReport "SALES REPORT", acViewPreview, , "[OKCUNM] = 'BATALION MOTORS'"
3)Text9.SetFocus
Text9.Text = Me.DEALER_COMBO.Value
4)DoCmd.OpenReport "SALES REPORT", acViewPreview, , "[OKCUNM]" = Form!DEALER_COMBO.Value

The second and third lines of code are just tests. OKCUNM is a field on the report which is running on a query.
If I comment line 4 everything works fine with the set condition in line 2, but I want the condition to be fulfilled by combo box which I'm trying to do in line 4.
In line 4 the value from Form!DEALER_COMBO.Value is not getting stored in OKCUNM
Please Help
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 20
Reputation: saurabh_kanwar is an unknown quantity at this point 
Solved Threads: 0
saurabh_kanwar saurabh_kanwar is offline Offline
Newbie Poster

Re: VBA Combo Box Problem

 
0
  #2
Oct 4th, 2006
Someone helped me with the solution already guys.

The code was supposed to be
DoCmd.OpenReport "SALES REPORT", acViewPreview, ,"[OKCUNM]='" & Form!DEALER_COMBO.Value & "'"

Thanks for your time
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC