Results 1 to 6 of 6

Thread: Querys

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2004
    Location
    Saudi Arabia for now!
    Posts
    12

    Querys

    Ok, How do you set the criteria fields from VB6? I want to only return records that meet two criteria which is picked from list boxes on the current form.

    I am able to open the query, but then I am stuck. Thanks!
    Lead, Follow, or Get the Hell out of the way!!!!

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    For access, crystal, or data report?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    New Member
    Join Date
    Aug 2004
    Location
    Saudi Arabia for now!
    Posts
    12
    Sorry...in Access, but I am not doing it with a data environment since it still does not work.
    Lead, Follow, or Get the Hell out of the way!!!!

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    Sorry, but I have not used the DE before, but I think the query, if
    in access, would need to have the parameters already created.

    Also, if the table does not contain too many records then you
    could do a ADO filter, that is if you are using ADO.

    What are you using to connect to Access? The DE
    connectionstring built as ???
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  5. #5

    Thread Starter
    New Member
    Join Date
    Aug 2004
    Location
    Saudi Arabia for now!
    Posts
    12
    So far, I am able to connect to my database and open my query with the following code. Now I need to pass a variables from two fields, Level and Phase to get my recordset used to generate a random test.

    Private Sub PRINT_Click()
    'On Error Resume Next
    Dim objAccess As Access.Application
    'Dim rst As DAO.Recordset
    'Dim rstTest As DAO.Recordset
    Dim z As Integer
    Dim Mz As Integer

    Set objAccess = CreateObject("Access.Application")
    With objAccess
    .OpenCurrentDatabase "c:\PMEL\PMEL.mdb"
    .Visible = True
    .DoCmd.OpenQuery "Level", acViewDesign

    (this code works, just got tired of printing the wrong info)
    '.DoCmd.OpenReport "TestQuestions", acPreview
    '.DoCmd.PrintOut
    '.DoCmd.Close
    '.DoCmd.OpenReport "TestAnswers", acPreview
    '.DoCmd.PrintOut
    '.DoCmd.Close
    '.CloseCurrentDatabase
    'Set objAccess = Nothing
    Gen_Test.Hide
    Main_Menu.Show
    End With
    objAccess.QUIT
    End Sub
    Lead, Follow, or Get the Hell out of the way!!!!

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    I believe there is a parameters collection or object in access that
    you need to use. Either that or alter the query with the
    parameters hard coded. Then save and run the report.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

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