Need help print access report from VB6

A

Angel b1

Hello,

I have a Vb 6 application that prompts the user for the criteria used in a
access97 report and then prints the Access report.
I would like to see just the ONE prompt, VB OR the Access criteria prompt.
Im currently getting two prompts.


Here is my code

result = InputBox("Enter Starting Range, MMYYYY", vbOKCancel, "Print
Invoices")

Set appAccess = New Access.Application
appAccess.OpenCurrentDatabase
"c:\vb_projects\PriorAuthInvoice\PriorAuthInvoice.MDB"
Set qrySelectCurrentInvoices =
appAccess.CurrentDb.QueryDefs("qrySelectInvoices")
qrySelectCurrentInvoices.Parameters("Enter Invoice Date:") = result
appAccess.DoCmd.OpenReport "TBLINVOICE", acViewPreview

Screen.MousePointer = vbHourglass
appAccess.DoCmd.PrintOut acPrintAll
appAccess.CloseCurrentDatabase
appAccess.Quit
Set appAccess = Nothing



Expand AllCollapse All
 
M

[MVP] S.Clark

If I had to wager a guess, I'd bet the parameter name "Enter Invoice Date:"
does not match the parameter name in the query. It has to match, letter for
letter, character for character. Open the query and compare the two
strings.
 
A

Angel b1

Thanks but the two strings are the same.

[MVP] S.Clark said:
If I had to wager a guess, I'd bet the parameter name "Enter Invoice Date:"
does not match the parameter name in the query. It has to match, letter for
letter, character for character. Open the query and compare the two
strings.
 
J

John Spencer (MVP)

It could be that the report runs the query separately and has no idea that you
have told the query what value the parameter has.

You might try changing the paramater in the underlying query to read
"Enter Starting Range, 'mmYYYY'"
and dropping all the code relevant to the query.
 

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

Top