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.

Private Sub Combo3_Click()
If Combo3.Text <> "" Then
Set rs = New ADODB.Recordset
rs.Open "select materials.unit from Materials Where Materials.productname=" & Combo3.Text & ", con,adopendynamic,adlockoptimistic"
TxtUnit.Text = rs!Unit
End If
End Sub

Hi,

If Product Name is String, then Wrap it with Single Quotes :
Try This :

Set rs = Nothing
Set rs = New ADODB.Recordset
rs.Open "select materials.unit from Materials Where Materials.productname='" & Combo3.Text & "'",  Con
' Rest of Coding Remains Same
'

Regards
Veena

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.