|
-
Aug 6th, 2004, 10:04 AM
#1
Thread Starter
New Member
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!!!!
-
Aug 6th, 2004, 10:22 AM
#2
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 Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API 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 
-
Aug 6th, 2004, 10:43 AM
#3
Thread Starter
New Member
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!!!!
-
Aug 6th, 2004, 10:57 AM
#4
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 Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API 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 
-
Aug 6th, 2004, 12:34 PM
#5
Thread Starter
New Member
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!!!!
-
Aug 6th, 2004, 12:59 PM
#6
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 Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API 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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|