Combo box troubles

  • Thread starter Thread starter Jeena
  • Start date Start date
J

Jeena

Seems I can't use the wizard to create a combo box
to "find a record on a form" if I use the query builder
under the control source to put together the form. The
combo box wizard immediately returns a syntax error. Any
way around this?

Jeena
 
Jeena said:
Seems I can't use the wizard to create a combo box
to "find a record on a form" if I use the query builder
under the control source to put together the form. The
combo box wizard immediately returns a syntax error. Any
way around this?

When you say "if I use the query builder under the control source", do
you actually mean "record source"? Have you built a valid query to be
the form's recordsource? If you put the form into form view, do you get
an error or parameter prompt?
 
Hi Jeena,
It may help if you understand what you get when using the
wizard to create a combo box to 'find a record on a form'.

Private Sub cboFindRecord()
dim strCriteria as string
' find criteria for a field that matches selected item in
combobox.
' assumes first, usually hidden column of combobox is
primarykey field
strCriteria="[PrimaryKey]=" & cboFindRecord
' search for matching record
me.recordsetclone.findfirst strCriteria
' goto found record
me.bookmark=me.recordsetclone.bookmark
end sub

using the above as an example you can then adjust names to
match that of your combobox and primarykey field.

Luck
Jonathan
 
My mistake - sorry!! I did use the query bldr
under "Record Source" The form works fine. I can add,
edit, delete... all the normal stuff you do with a form
(this form has a subform, by the way, if that makes a
difference.)

The syntax error come up in the combo box wizard after
selecting a field and hitting "Next." Even if I select
ONLY the primary key, I get the error "Syntax error in
FROM clause" and that's as far as it goes!

I've had this come up before, but I don't see the pattern.
 
SORRY! - I goofed up in my original post. I used the
Query builder at the "Record Source" as you stated, but
the FORM works fine... I can Add, Delete, Edit... all the
things you're supposed to do. I can go to a record ONLY
with the Navigation Control, which is obviouly not an
option. The Combo box wizard give a Sytax error
saying "Error in FROM clause" This occurs even if I
select ONLY the primary key as a field for the box, then
click "NEXT." This form DOES have a subform if that makes
any difference. The subform is NOT base on a query - it
is srtaight from a related table.
 
Jeena said:
My mistake - sorry!! I did use the query bldr
under "Record Source" The form works fine. I can add,
edit, delete... all the normal stuff you do with a form
(this form has a subform, by the way, if that makes a
difference.)

The syntax error come up in the combo box wizard after
selecting a field and hitting "Next." Even if I select
ONLY the primary key, I get the error "Syntax error in
FROM clause" and that's as far as it goes!

I've had this come up before, but I don't see the pattern.

What is the recordsource of the form? Does it include any references to
this or other forms?
 
Back
Top