|
-
May 4th, 2000, 06:22 PM
#1
Thread Starter
Lively Member
Hi
I'm writing a visual basic program to automate a series of remote site dial in status checks.
After each site is checked I am writing back the site name and status to a table in an access database.
I want to enable users to print an access report depending on the date they put into a text box on one of my VB forms.
The report takes it's data from a query in the database.
The select query currently goes like this:
SELECT * FROM tblMain WHERE Date =
What do I need to put on the end in order to make the query dependant on the string from my VB project (strCurrentDate)
Any suggestions would be much appreciated.
Best Regards.
Rob Brown
-
May 4th, 2000, 06:49 PM
#2
Addicted Member
Follow these steps:
1. Set the report's data source to the table "tblMain".
2. Add a reference to the Microsoft Access Object Library.
3. Use this code snippet to open the report:
Dim AccessApp As Access.Application
Set AccessApp=New Access.Application
AccessApp.OpenCurrentDb YourDatabasePath
AccessApp.DoCmd.OpenReport YourReportName,,,"[Date]=#" & _ Form1.txtDate.Text & "#"
Explanation: Instead of changing the Access query's SQL statement, you can launch Access from VB and display the report with a filter.
Hope this will help you!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|