943,596 Members | Top Members by Rank

Ad:
Apr 28th, 2009
0

getting records on the basis of combo box

Expand Post »
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
Similar Threads
Reputation Points: 7
Solved Threads: 1
Posting Pro in Training
firoz.raj is offline Offline
415 posts
since Dec 2008
Apr 28th, 2009
0

Re: getting records on the basis of combo box

Hi,

If Product Name is String, then Wrap it with Single Quotes :
Try This :
vb Syntax (Toggle Plain Text)
  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
Reputation Points: 84
Solved Threads: 140
Posting Shark
QVeen72 is offline Offline
923 posts
since Nov 2006

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Mcrypt_cbc with TripleDES for vb6
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: I am finding command addfont into registry of windows





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC