Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo box and Data.recorset

Status
Not open for further replies.

nkyeshi01

Programmer
Nov 4, 2004
29
US
Hello all!

From the selection of an item of the combo box I am trying to look for the corresponding record in the DB. This is what I am using:

Private Sub Combo1_Click()
Dim yourpick, var As String

yourpick = Combo1.Text
Data1.Recordset.MoveFirst 'HERE i GET THE ERROR,DESC BELOW
1:
If yourpick = Combo1.Text Then
Combo1.Enabled = True
Text2.Enabled = True
Text3.Enabled = True
Text4.Enabled = True
Text5.Enabled = True
Text6.Enabled = True
Text7.Enabled = True
Text8.Enabled = True
Text9.Enabled = True
Text10.Enabled = True
Text12.Enabled = True
Text13.Enabled = True
Text14.Enabled = True
Text15.Enabled = True
Text16.Enabled = True
Text17.Enabled = True
Text18.Enabled = True

Exit Sub
Else
Data1.Recordset.MoveNext
GoTo 1
End If
End Sub

ERROR: Run-time error '3426': This action was cancelled by an associated object


What am I doing wrong???? Please Help!!


Thank you.
 
Do you have that ComboBox [bold]bind[/bold]to the recordset of Data1 control?
 
yes, actually I can list the contains, I have it like this:

Public Sub loadCombo()
Dim var As String
Data1.Recordset.MoveFirst
Do While Not Data1.Recordset.EOF
var = Combo1.Text
Combo1.AddItem var
Data1.Recordset.MoveNext
Loop
End Sub

and it fills up, this is the part that works
 
yes, actually I can list the contains, I have it like this:

Public Sub loadCombo()
Dim var As String
Data1.Recordset.MoveFirst
Do While Not Data1.Recordset.EOF
var = Combo1.Text
Combo1.AddItem var
Data1.Recordset.MoveNext
Loop
End Sub

and it fills up, this is the part that works.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top