944,085 Members | Top Members by Rank

Ad:
Oct 4th, 2006
0

VBA Combo Box Problem

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
saurabh_kanwar is offline Offline
20 posts
since Sep 2006
Oct 4th, 2006
0

Re: VBA Combo Box Problem

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
saurabh_kanwar is offline Offline
20 posts
since Sep 2006

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: IsNull using VB 6 and SQL SERVER 2000
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Updating ADODC





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC