VB 6.0 - How to create query in access using vb6 0

Asked By CHANDU V on 04-Jul-06 03:12 AM

1.how to create query in access using vb6.0 through ADO's. 
    without open mdb file how to create query

2. how to display access report through vb 6.0.

anybody help me.

thanks in advance

re - Asked By Rupali Randhave Kolhe on 04-Jul-06 05:06 AM

Create query in access:

Here is how to create a temporary QueryDef: 
Dim db as Database 

Sub QDExample() 

Dim qd as QueryDef 
Dim pramA as Parameter 
Dim pramB as Parameter 
Dim SQL as String 

SQL = SQL & "YourVarB INTEGER; " 
SQL = SQL & "SELECT fieldA, 
SQL = SQL & "[YourVarA] as fieldB " 
SQL = SQL & "INTO temptable " 
SQL = SQL & "FROM [your table] " 
SQL = SQL & "WHERE thisfield = [YourVarB] " 

Set qd = db.CreateQueryDef("",SQL) 
Set pramA = qd!YourVarA 
Set pramB = qd!YourVarB 

pramA = "A string" 
pramB = 555 



End Sub 

If you have a Access Database with an existing QueryDef then do this 

Set qd = db.QueryDefs("<the name of the querydef>") 

<<<To delete this QueryDef>>> 
db.QueryDefs.Delete qd.Name 

Hope this helps,

Open/Print report - Asked By Rupali Randhave Kolhe on 04-Jul-06 05:08 AM


error occured - Asked By CHANDU V on 04-Jul-06 07:14 AM


I do this type process, there is an error occured ie. unrecognised database format. 

so, there is any possibility using ADO's to create query in access database. 

Oracle - Asked By mohd jahed on 05-Jul-06 03:51 AM
How many type of databases are there? briefly describe each one's functions.
What is Groupby clause? Whether we can restrict columns with the help of groupby clause.