|
-
Oct 13th, 2004, 12:44 PM
#1
Thread Starter
Member
Update QUERY
Hello All;
am new to VBA and Access
I have a situation where i have two combo boxes (named a , b)
when the user select an item from combo "a", i want to load some values from a table and load them into combo box 'b"
how can i insert value of the combo box into the Query? can anyone please provide an example?
another question, how can i pass a parameter to a report (when opering it) how's the button's calling the report should be coded, and the report, how can it get it?
-
Oct 13th, 2004, 01:27 PM
#2
Answer to Q#2:
VB Code:
Application.DoCmd.OpenReport "TestQuestions", acViewPreview, ,"WHERE Something = 'Somethingelse'", acWindowNormal
Answer to Q#1:
VB Code:
Option Explicit
Private Sub Combo1_Click()
Call PopulateCBO
End Sub
Private Sub Combo1_KeyUp(KeyCode As Integer, Shift As Integer)
Call PopulateCBO
End Sub
Private Function PopulateCBO()
'Using your previously populated recordset from database
With Combo2
DoEvents
.Clear
Do While RS.EOF = False
.AddItem RS.Fields("Field1").Value
RS.MoveNext
Loop
End With
End Function
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 
-
Oct 13th, 2004, 01:51 PM
#3
Thread Starter
Member
Thanks,
As for question 1:
i need to update the recodSource as follows:
select OfferID from Offers Where X = THE VALUE OF THE SELECTED COMBO!
whats the exact statement of it ?
-
Oct 13th, 2004, 02:08 PM
#4
To retrieve the selected items?
Code:
"SELECT OfferID FROM Offers WHERE X = '" & Combo1.Text & "'"
To update the selected item with a value from combo 2?
Code:
"UPDATE Table1 SET Field1 = '" & Combo2.Text & "' WHERE Field1 = '" & Combo1.Text & "'"
Not sure how you need them to work, but those are the syntax.
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
|