Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PROBLEM ACCESSING ACCESS QUERIES AND REPORTS FROM VB6

Status
Not open for further replies.

20002000

Programmer
May 2, 2001
2
GB
i AM BUILDING A DATABASE APPLICATION THAT USES AN ACCESS DATABASE. THE QURIES AND REPORTS WORK WELL IN ACCESS. I DECIDED TO BUILD THE FORMS USING VB DATACONTROLS. i HAVE GOT THE DATABASE WORKING FINE BUT i DO NOT KNOW HOW TO ACCESS THE QUERIES AND REPORTS SET UP AND SAVED IN ACCESS.
PLEASE I NEED TIPS ON HOW TO DO THIS. i AM DESPERATE.
 
Perhaps you can try this. It is just for query's.

First you must add the line
PARAMETERS in your query.

Your name for the query (ex: TEST)
ex: PARAMETERS FName text;
Select *
from Authors
where Firstname = Fname;


In VB you can use this code

dim cmd as new ADODB.Command
Dim ParmTemp as adodb.Paramter

set cmd.activeconnection = cn
cmd.commandtext = "Test" 'Name of the query
cmd.commandtype=adcdmStoredProc
set parmTemp=cmd.createParameter("Fname", adchar, adParmamInput, 255)
cmd.parameters.append parmtemp
cmd("FName") = "John" 'This can also be an variable
set rs = cmd.execute

Let me know if it works?
 
To run your Access reports from VB, create a reference to the Microsoft Access Object Library, and use the following code:

Dim Axs As Access.Application
Set Axs = CreateObject("Access.Application")
Axs.OpenCurrentDatabase (App.Path & "\YourDB.mdb")
Axs.DoCmd.OpenReport "YourReportName"
Axs.Quit
 
How would you then use this to open a database that belonged to a workgroup with a username and password?

Eradic8or.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top