Combo box to a report

J

jppigao

Hello it's me again,

Something stroke my mind for the last couple of days and what i am
trying to accomplish is to have a report that the user will pick from
a combo box. This combo box has it's own table namely tbl_Site. Now in
my main Module namely Delivery Note i have this combo box so that the
user will just click the drop down button and choose the perfect site
and so on with his manual input of data.

Now i have created a form or an individual dialog box and inside it is
the tbl_Site Combo Box and a Preview Button. Now what i wanted is
that, when the user select a certain site via that Combo Box and he/
she click the Preview button, A report will generate and under it is
the Delivery Note/s that correspond to the site.

Is this possible?

Thank you in advance and God bless!
 
M

Marshall Barton

Something stroke my mind for the last couple of days and what i am
trying to accomplish is to have a report that the user will pick from
a combo box. This combo box has it's own table namely tbl_Site. Now in
my main Module namely Delivery Note i have this combo box so that the
user will just click the drop down button and choose the perfect site
and so on with his manual input of data.

Now i have created a form or an individual dialog box and inside it is
the tbl_Site Combo Box and a Preview Button. Now what i wanted is
that, when the user select a certain site via that Combo Box and he/
she click the Preview button, A report will generate and under it is
the Delivery Note/s that correspond to the site.


Use the button wizard to create the preview command button
with code to open the report. Then modify the code to use
the OpenReport method's WhereCondition argument. The code
should end up looking something like:

Dim stDoc As String
Dim stWhere As String
stDoc = "name of report goes here"
stWhere = "[site field] = " & Me.[combo name]
DoCmd.OpenReport stDoc, acViewPewview, , stWhere

Then just base the report on the delivery notes table.
 
J

jppigao

Hello Marsh and a blessed day,

I am receiving an error Run Time Error 13: Type Mismatch

Also i correct the "Preview" in "DoCmd.OpenReport stDoc,
acViewPewview, , stWhere"
but still same problem occured.

Now Marsh in the tbl_DeliveryNote where i base my report i have
mentioned there that the Site is on a lookup method not a text nor a
number. Would that be any concern? As far as my understanding goes
there is some rule about the " in the statement but frankly speaking i
don't know how to use it for now.

Also the unbound form i have created for the report is base in the
query i have made for the Site table so that it will be in ascending
list. Would that be any concern also?

Thanks Marsh for the help hope you can help me debug this problem.



Something stroke my mind for the last couple of days and what i am
trying to accomplish is to have a report that the user will pick from
a combo box. This combo box has it's own table namely tbl_Site. Now in
my main Module namely Delivery Note i have this combo box so that the
user will just click the drop down button and choose the perfect site
and so on with his manual input of data.
Now i have created a form or an individual dialog box and inside it is
the tbl_Site Combo Box and a Preview Button. Now what i wanted is
that, when the user select a certain site via that Combo Box and he/
she click the Preview button, A report will generate and under it is
the Delivery Note/s that correspond to the site.

Use the button wizard to create the preview command button
with code to open the report. Then modify the code to use
the OpenReport method's WhereCondition argument. The code
should end up looking something like:

Dim stDoc As String
Dim stWhere As String
stDoc = "name of report goes here"
stWhere = "[site field] = " & Me.[combo name]
DoCmd.OpenReport stDoc, acViewPewview, , stWhere

Then just base the report on the delivery notes table.
 
M

Marshall Barton

Sorry about the typo.

Are you saying that that the Site field in the Delivery
Notes table is a lookup field? If so, then I strongly
suggest that you change it back to a text box so you can see
what is actually in the field. See the second commandment
at http://www.mvps.org/access/tencommandments.htm

The code I suggested assumed that the Site field in the
table is numeric type field. If it's really a Text field
then change the one line to something like:

stWhere = "[site field] = """ & Me.[combo name] & """"
--
Marsh
MVP [MS Access]


I am receiving an error Run Time Error 13: Type Mismatch

Also i correct the "Preview" in "DoCmd.OpenReport stDoc,
acViewPewview, , stWhere"
but still same problem occured.

Now Marsh in the tbl_DeliveryNote where i base my report i have
mentioned there that the Site is on a lookup method not a text nor a
number. Would that be any concern? As far as my understanding goes
there is some rule about the " in the statement but frankly speaking i
don't know how to use it for now.

Also the unbound form i have created for the report is base in the
query i have made for the Site table so that it will be in ascending
list. Would that be any concern also?


Something stroke my mind for the last couple of days and what i am
trying to accomplish is to have a report that the user will pick from
a combo box. This combo box has it's own table namely tbl_Site. Now in
my main Module namely Delivery Note i have this combo box so that the
user will just click the drop down button and choose the perfect site
and so on with his manual input of data.
Now i have created a form or an individual dialog box and inside it is
the tbl_Site Combo Box and a Preview Button. Now what i wanted is
that, when the user select a certain site via that Combo Box and he/
she click the Preview button, A report will generate and under it is
the Delivery Note/s that correspond to the site.

Use the button wizard to create the preview command button
with code to open the report. Then modify the code to use
the OpenReport method's WhereCondition argument. The code
should end up looking something like:

Dim stDoc As String
Dim stWhere As String
stDoc = "name of report goes here"
stWhere = "[site field] = " & Me.[combo name]
DoCmd.OpenReport stDoc, acViewPewview, , stWhere

Then just base the report on the delivery notes table.
 
J

jppigao

Hello marsh,

actually i tried to play around it yesterday morning before my hard
drive died so now it is working perfectly just what i wanted. Marsh i
really appreciated your help..a million thanks!

God bless! Thanks for this forum!

Sorry about the typo.

Are you saying that that the Site field in the Delivery
Notes table is a lookup field? If so, then I strongly
suggest that you change it back to a textboxso you can see
what is actually in the field. See the second commandment
athttp://www.mvps.org/access/tencommandments.htm

The code I suggested assumed that the Site field in the
table is numeric type field. If it's really a Text field
then change the one line to something like:

stWhere = "[site field] = """ & Me.[comboname] & """"
--
Marsh
MVP [MS Access]



I am receiving an error Run Time Error 13: Type Mismatch
Also i correct the "Preview" in "DoCmd.OpenReport stDoc,
acViewPewview, , stWhere"
but still same problem occured.
Now Marsh in the tbl_DeliveryNote where i base myreporti have
mentioned there that the Site is on a lookup method not a text nor a
number. Would that be any concern? As far as my understanding goes
there is some rule about the " in the statement but frankly speaking i
don't know how to use it for now.
Also the unbound form i have created for thereportis base in the
query i have made for the Site table so that it will be in ascending
list. Would that be any concern also?
(e-mail address removed) wrote:
Something stroke my mind for the last couple of days and what i am
trying to accomplish is to have areportthat the user will pick from
acombobox. Thiscomboboxhas it's own table namely tbl_Site. Now in
my main Module namely Delivery Note i have thiscomboboxso that the
user will just click the drop down button and choose the perfect site
and so on with his manual input of data.
Now i have created a form or an individual dialogboxand inside it is
the tbl_SiteComboBoxand a Preview Button. Now what i wanted is
that, when the user select a certain site via thatComboBoxand he/
she click the Preview button, Areportwill generate and under it is
the Delivery Note/s that correspond to the site.
Use the button wizard to create the preview command button
with code to open thereport. Then modify the code to use
the OpenReport method's WhereCondition argument. The code
should end up looking something like:
Dim stDoc As String
Dim stWhere As String
stDoc = "name ofreportgoes here"
stWhere = "[site field] = " & Me.[comboname]
DoCmd.OpenReport stDoc, acViewPewview, , stWhere
Then just base thereporton the delivery notes table.- Hide quoted text -

- Show quoted text -
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top