Results 1 to 7 of 7

Thread: Open Access Query

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 1999
    Location
    Malaysia
    Posts
    108
    Hello...

    How to open and use the Access Query from VB6.
    I mean I want use that for my application.

  2. #2
    Addicted Member
    Join Date
    Oct 1999
    Posts
    253
    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!



  3. #3

    Thread Starter
    Lively Member
    Join Date
    Aug 1999
    Location
    Malaysia
    Posts
    108

    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.

  4. #4
    Addicted Member
    Join Date
    Oct 1999
    Posts
    253
    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!!!

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Aug 1999
    Location
    Malaysia
    Posts
    108

    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

  6. #6
    Hyperactive Member
    Join Date
    Jun 1999
    Posts
    308

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Aug 1999
    Location
    Malaysia
    Posts
    108

    Cool 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
  •  



Click Here to Expand Forum to Full Width