unbound combo box

G

Guest

I have a form (InmateSelect) where I am trying to use an unbound combo box
(cboInmateSelect) to select records from a table named Downinfo. The unbound
combo box will display three fields from this table named CDCnum, InmateName,
and InmateHousing. When I select a CDCnum, the data, which is text, is
displayed, in the combo box however I get an error

Run-time error ‘3070’:
The Microsoft Jet Database engine does not recognize ‘F26776’ (which is the
data I selected) as a valid field or expression.

I also have 3 bound text boxes that I want the data selected to be
displayed. At this point none of the data is displayed in the text boxes.
This is the code I am using and the database is designed to edit/update the
table and query the information.


Private Sub cboInmate_Select_AfterUpdate()

Dim rst As DAO.Recordset
Set rst = Me.RecordsetClone
rst.FindFirst "[CDCnum] = " & Me.cboInmate_Select
If Not rst.NoMatch Then
Me.Bookmark = rst.Bookmark
End If
Set rst = Nothing
End Sub

Can anyone help me with this?

Thanks
Ducat assignment
 
R

ruralguy via AccessMonster.com

The line:
rst.FindFirst "[CDCnum] = " & Me.cboInmate_Select
Is looking for a numerical value but F26776 can't be numerical. Try:
rst.FindFirst "[CDCnum] = " & Chr(34) & Me.cboInmate_Select & Chr(34)


ducat said:
I have a form (InmateSelect) where I am trying to use an unbound combo box
(cboInmateSelect) to select records from a table named Downinfo. The unbound
combo box will display three fields from this table named CDCnum, InmateName,
and InmateHousing. When I select a CDCnum, the data, which is text, is
displayed, in the combo box however I get an error

Run-time error ‘3070’:
The Microsoft Jet Database engine does not recognize ‘F26776’ (which is the
data I selected) as a valid field or expression.

I also have 3 bound text boxes that I want the data selected to be
displayed. At this point none of the data is displayed in the text boxes.
This is the code I am using and the database is designed to edit/update the
table and query the information.

Private Sub cboInmate_Select_AfterUpdate()

Dim rst As DAO.Recordset
Set rst = Me.RecordsetClone
rst.FindFirst "[CDCnum] = " & Me.cboInmate_Select
If Not rst.NoMatch Then
Me.Bookmark = rst.Bookmark
End If
Set rst = Nothing
End Sub

Can anyone help me with this?

Thanks
Ducat assignment
 
G

Guest

Is the field [CDCnum] the bound column of the combo box??

Is the field [CDCnum] a text field?

IF the field [CDCnum] is the bound column and it is a text field, instead of
this
rst.FindFirst "[CDCnum] = " & Me.cboInmate_Select


try:

rst.FindFirst "[CDCnum] = '" & Me.cboInmate_Select & "'"


That is

rst.FindFirst "[CDCnum] =/space/single quote/double quote/space/&
Me.cboInmate_Select &/double quote/single quote/double quote

HTH
--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


ducat assignment said:
I have a form (InmateSelect) where I am trying to use an unbound combo box
(cboInmateSelect) to select records from a table named Downinfo. The unbound
combo box will display three fields from this table named CDCnum, InmateName,
and InmateHousing. When I select a CDCnum, the data, which is text, is
displayed, in the combo box however I get an error

Run-time error ‘3070’:
The Microsoft Jet Database engine does not recognize ‘F26776’ (which is the
data I selected) as a valid field or expression.

I also have 3 bound text boxes that I want the data selected to be
displayed. At this point none of the data is displayed in the text boxes.
This is the code I am using and the database is designed to edit/update the
table and query the information.


Private Sub cboInmate_Select_AfterUpdate()

Dim rst As DAO.Recordset
Set rst = Me.RecordsetClone
rst.FindFirst "[CDCnum] = " & Me.cboInmate_Select
If Not rst.NoMatch Then
Me.Bookmark = rst.Bookmark
End If
Set rst = Nothing
End Sub

Can anyone help me with this?

Thanks
Ducat assignment
 
G

Guest

Also, I would add a message box to tell when there was not a match.


Private Sub cboInmate_Select_AfterUpdate()

Dim rst As DAO.Recordset
Set rst = Me.RecordsetClone
rst.FindFirst "[CDCnum] = '" & Me.cboInmate_Select & "'"
If Not rst.NoMatch Then
Me.Bookmark = rst.Bookmark
Else
MsgBox "No Matching record for " & Me.cboInmate_Select
End If
Set rst = Nothing
End Sub

I like knowing when there is no match, rather than assuming the code ran.

--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


SteveS said:
Is the field [CDCnum] the bound column of the combo box??

Is the field [CDCnum] a text field?

IF the field [CDCnum] is the bound column and it is a text field, instead of
this
rst.FindFirst "[CDCnum] = " & Me.cboInmate_Select


try:

rst.FindFirst "[CDCnum] = '" & Me.cboInmate_Select & "'"


That is

rst.FindFirst "[CDCnum] =/space/single quote/double quote/space/&
Me.cboInmate_Select &/double quote/single quote/double quote

HTH
--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


ducat assignment said:
I have a form (InmateSelect) where I am trying to use an unbound combo box
(cboInmateSelect) to select records from a table named Downinfo. The unbound
combo box will display three fields from this table named CDCnum, InmateName,
and InmateHousing. When I select a CDCnum, the data, which is text, is
displayed, in the combo box however I get an error

Run-time error ‘3070’:
The Microsoft Jet Database engine does not recognize ‘F26776’ (which is the
data I selected) as a valid field or expression.

I also have 3 bound text boxes that I want the data selected to be
displayed. At this point none of the data is displayed in the text boxes.
This is the code I am using and the database is designed to edit/update the
table and query the information.


Private Sub cboInmate_Select_AfterUpdate()

Dim rst As DAO.Recordset
Set rst = Me.RecordsetClone
rst.FindFirst "[CDCnum] = " & Me.cboInmate_Select
If Not rst.NoMatch Then
Me.Bookmark = rst.Bookmark
End If
Set rst = Nothing
End Sub

Can anyone help me with this?

Thanks
Ducat assignment
 
G

Guest

SteveS

Thanks very much, your info worked and solved my problem.

SteveS said:
Also, I would add a message box to tell when there was not a match.


Private Sub cboInmate_Select_AfterUpdate()

Dim rst As DAO.Recordset
Set rst = Me.RecordsetClone
rst.FindFirst "[CDCnum] = '" & Me.cboInmate_Select & "'"
If Not rst.NoMatch Then
Me.Bookmark = rst.Bookmark
Else
MsgBox "No Matching record for " & Me.cboInmate_Select
End If
Set rst = Nothing
End Sub

I like knowing when there is no match, rather than assuming the code ran.

--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


SteveS said:
Is the field [CDCnum] the bound column of the combo box??

Is the field [CDCnum] a text field?

IF the field [CDCnum] is the bound column and it is a text field, instead of
this
rst.FindFirst "[CDCnum] = " & Me.cboInmate_Select


try:

rst.FindFirst "[CDCnum] = '" & Me.cboInmate_Select & "'"


That is

rst.FindFirst "[CDCnum] =/space/single quote/double quote/space/&
Me.cboInmate_Select &/double quote/single quote/double quote

HTH
--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


ducat assignment said:
I have a form (InmateSelect) where I am trying to use an unbound combo box
(cboInmateSelect) to select records from a table named Downinfo. The unbound
combo box will display three fields from this table named CDCnum, InmateName,
and InmateHousing. When I select a CDCnum, the data, which is text, is
displayed, in the combo box however I get an error

Run-time error ‘3070’:
The Microsoft Jet Database engine does not recognize ‘F26776’ (which is the
data I selected) as a valid field or expression.

I also have 3 bound text boxes that I want the data selected to be
displayed. At this point none of the data is displayed in the text boxes.
This is the code I am using and the database is designed to edit/update the
table and query the information.


Private Sub cboInmate_Select_AfterUpdate()

Dim rst As DAO.Recordset
Set rst = Me.RecordsetClone
rst.FindFirst "[CDCnum] = " & Me.cboInmate_Select
If Not rst.NoMatch Then
Me.Bookmark = rst.Bookmark
End If
Set rst = Nothing
End Sub

Can anyone help me with this?

Thanks
Ducat assignment
 

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