unbound combo box

  • Thread starter DucateAssignment via AccessMonster.com
  • Start date
D

DucateAssignment via AccessMonster.com

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
 
A

Allen Browne

The example data (F26776) suggests this is a Text field, not a Number field.

If it is a Text field, the value need to be in quotes, i.e.:
rst.FindFirst "[CDCnum] = """ & Me.cboInmate_Select & """"

If those quotes don't make sense, see:
Quotation marks within quotes
at:
http://allenbrowne.com/casu-17.html

Note that cboInmate must be an *unbound* control (so it doesn't try to save
this value). It may also be a good idea to explictly save the current record
before trying to find another one:
If Me.Dirty Then Me.Dirty = False
 
D

DucateAssignment via AccessMonster.com

Allen

I've played around with this issue for about a week and you tell me to use
quotation marks and this works. I've looked in three different books and
still had no idea. I thank you very much.

DucatAssignment

Allen said:
The example data (F26776) suggests this is a Text field, not a Number field.

If it is a Text field, the value need to be in quotes, i.e.:
rst.FindFirst "[CDCnum] = """ & Me.cboInmate_Select & """"

If those quotes don't make sense, see:
Quotation marks within quotes
at:
http://allenbrowne.com/casu-17.html

Note that cboInmate must be an *unbound* control (so it doesn't try to save
this value). It may also be a good idea to explictly save the current record
before trying to find another one:
If Me.Dirty Then Me.Dirty = False
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
[quoted text clipped - 31 lines]
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