can't get combo boxes to work

M

maura

Can't seem to get either of these combo boxes to work.
Both are on the same form and I have been playing around
with them, but can seem to get them to pull up the right
record, or I get a runtime error '3464' Data Type Mismatch
in Criteria Expression. But I don't understand what is
mismatched. Can you help. Thanks.

Private Sub Combo57_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[TransStock]= '" & Me![Combo57] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

Private Sub Combo59_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[TransReference] = " & Str(Nz(Me!
[Combo59], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
 
T

tina

what is the data type of field [TransStock]?
what is the data type of the *bound* column of Combo57?
what is the data type of field [TransReference]?
what is the data type of the *bound* column of Combo59?
 
G

Guest

In looking at this I think I want the combo box to bring
up the main field which is:

TransID

Both combo boxes are unbound. Data type for TransStock and
TransReference are both text. TransID is an autonumber and
when I try this in the code I get the run time error 3079
Specific field 'TransID' could refer to more than one
table listed in teh FROM clause of your SQL statment... so
I tried putting tblTransports.TransID, I get a run time
error 3345 Unknown or invalid field
reference '[tblTransports.TransID]'.
-----Original Message-----
what is the data type of field [TransStock]?
what is the data type of the *bound* column of Combo57?
what is the data type of field [TransReference]?
what is the data type of the *bound* column of Combo59?


Can't seem to get either of these combo boxes to work.
Both are on the same form and I have been playing around
with them, but can seem to get them to pull up the right
record, or I get a runtime error '3464' Data Type Mismatch
in Criteria Expression. But I don't understand what is
mismatched. Can you help. Thanks.

Private Sub Combo57_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[TransStock]= '" & Me![Combo57] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

Private Sub Combo59_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[TransReference] = " & Str(Nz(Me!
[Combo59], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub


.
 
T

tina

an unbound combo box does not have a ControlSource in the form's underlying
table or query. but it always has a BoundColumn. that's the column that is
referenced from the RowSource table, query or SQL statement. and the field
that populates the bound column has a data type.
since you're getting a Type Mismatch error, the first thing to check is the
data types in the FindFirst line of code, for each combo box.
so i need to know, what is the data type of the bound column of each combo
box?


In looking at this I think I want the combo box to bring
up the main field which is:

TransID

Both combo boxes are unbound. Data type for TransStock and
TransReference are both text. TransID is an autonumber and
when I try this in the code I get the run time error 3079
Specific field 'TransID' could refer to more than one
table listed in teh FROM clause of your SQL statment... so
I tried putting tblTransports.TransID, I get a run time
error 3345 Unknown or invalid field
reference '[tblTransports.TransID]'.
-----Original Message-----
what is the data type of field [TransStock]?
what is the data type of the *bound* column of Combo57?
what is the data type of field [TransReference]?
what is the data type of the *bound* column of Combo59?


Can't seem to get either of these combo boxes to work.
Both are on the same form and I have been playing around
with them, but can seem to get them to pull up the right
record, or I get a runtime error '3464' Data Type Mismatch
in Criteria Expression. But I don't understand what is
mismatched. Can you help. Thanks.

Private Sub Combo57_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[TransStock]= '" & Me![Combo57] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

Private Sub Combo59_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[TransReference] = " & Str(Nz(Me!
[Combo59], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub


.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top