|
-
Apr 6th, 2000, 03:47 PM
#1
Thread Starter
Lively Member
Hello...
How to open and use the Access Query from VB6.
I mean I want use that for my application.
-
Apr 6th, 2000, 07:26 PM
#2
Addicted Member
DAO:
Dim DB As Database, RecSet As Recordset
Set DB=DBEngine.Workspaces(0).OpenDatabase(DatabaseName)
Set RecSet=DB.OpenRecordset(QueryName)
ADO:
Dim RecSet As Recordset
Set RecSet=New Recordset
RecSet.Source=QueryName
Set RecSet.ActiveConnection=ConnectionName
RecSet.Open
If you need more details, tell me!
-
Apr 7th, 2000, 08:55 AM
#3
Thread Starter
Lively Member
DataReport Designer
Thanks Forest Dragon...
One more question..
If I want to use parameter query to my report, how to do that.
Could you or someone show to me please.
waiting response.
-
Apr 8th, 2000, 02:22 AM
#4
Addicted Member
If you mean you want to use a parameter query with VB's DataReport control, you need to follow these steps:
1. Use the DataEnvironment to create the new Command object.
2. Fill the SQL sentence of the Command object. Use the "?" character instead of the parameters.
Example: SELECT * FROM Customers WHERE CustomerID=?
3. Now click the parameters tab. You will see all your parameters. You cannot add or delete parameters to the list because it counts on the SQL sentence, but you can change their names.
4. Build the DataReport and bind it to the Command object.
5. Before you display the DataReport, you need to run the Command object and give it the values of the parameters. Example: DataEnvironment1.Command1 Parameter1,Parameter2, …
You should build a form that will let the user fill the values.
6. Now you can display your DataReport by using DataReport1.Show
Good Luck!!!
-
Apr 9th, 2000, 05:26 PM
#5
Thread Starter
Lively Member
Sending Parameter To Datareport
Thanks Forest Dragon for your response.
I've tried like your step above, but still have a problem.
I've got error message "Parameter?_1 has no default value"
Better if you can show one example to me.
My SQL sentence :
"SELECT * FROM Customer Where CustomerID=?"
My command name=Command1
My Parameter name=Param1
-
Apr 11th, 2000, 02:45 AM
#6
Hyperactive Member
-
Apr 11th, 2000, 09:33 PM
#7
Thread Starter
Lively Member
Thanks For Resolve My Problem
Hi...LG and Forest Dragon
Thanks a lot for helping me to carry out my problem and
good luck to you all.
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
|