getting records on the basis of combo box

Thread Solved

Join Date: Dec 2008
Posts: 292
Reputation: firoz.raj is an unknown quantity at this point 
Solved Threads: 1
firoz.raj firoz.raj is offline Offline
Posting Whiz in Training

getting records on the basis of combo box

 
0
  #1
Apr 28th, 2009
Can anybody tell me.How should i get value on the basis of combo box.i simple want when user click one of the productname from the combo box other corresponding fields from the database should come in the text box of the form.Here is the code what i have written.kindly help me.any help would be greately appreciated.right
now i am getting runtime error 3709.

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Private Sub Combo3_Click()
  2. If Combo3.Text <> "" Then
  3. Set rs = New ADODB.Recordset
  4. rs.Open "select materials.unit from Materials Where Materials.productname=" & Combo3.Text & ", con,adopendynamic,adlockoptimistic"
  5. TxtUnit.Text = rs!Unit
  6. End If
  7. End Sub
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 848
Reputation: QVeen72 is on a distinguished road 
Solved Threads: 120
QVeen72's Avatar
QVeen72 QVeen72 is offline Offline
Practically a Posting Shark

Re: getting records on the basis of combo box

 
0
  #2
Apr 28th, 2009
Hi,

If Product Name is String, then Wrap it with Single Quotes :
Try This :
  1. Set rs = Nothing
  2. Set rs = New ADODB.Recordset
  3. rs.Open "select materials.unit from Materials Where Materials.productname='" & Combo3.Text & "'", Con
  4. ' Rest of Coding Remains Same
  5. '

Regards
Veena
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC