Length limit for combo box query?

P

Patti

I have a combo box that provides a list of choices depending on the selection
of the previous combo box. The query is:

SELECT [tblStrategic Plan].[Action Plan ID] FROM [tblStrategic Plan] WHERE
((([tblStrategic Plan].[Strategic Objective])=[Forms]![Action
Plan]![cmbObjective]));

Works great except for two items, which happen to be the longest items --
137 and 197 characters. If those items are selected for cmbObjective, an
error box pops up:

The Microsoft database engine does not recognize "Forms" as a valid field
name or expression

Any idea why this is happening? Is there a character limit for the combo
box? The fields are both text fields in the table.

Thanks,

Patti
 
J

John Vinson

I have a combo box that provides a list of choices depending on the selection
of the previous combo box. The query is:

SELECT [tblStrategic Plan].[Action Plan ID] FROM [tblStrategic Plan] WHERE
((([tblStrategic Plan].[Strategic Objective])=[Forms]![Action
Plan]![cmbObjective]));

Works great except for two items, which happen to be the longest items --
137 and 197 characters. If those items are selected for cmbObjective, an
error box pops up:

The Microsoft database engine does not recognize "Forms" as a valid field
name or expression

Any idea why this is happening? Is there a character limit for the combo
box? The fields are both text fields in the table.

The limit to a field in a combo box is 255 bytes. I wonder if you
might have a ' or " character in the value of cmbObjective in the
combo box?

John W. Vinson[MVP]
 
J

John Vinson

The code is an after update event which performs a DLookup based on the
selection in the Action Plan ID field.

Private Sub CmbPlanID_AfterUpdate()
CmbPlan = DLookup("[Action Plans]", "tblStrategic Plan", "[Action Plan ID]=
[Forms]![Action Plan]![CmbPlanID]")
Me.TxtStatus.SetFocus
End Sub

Unless CabPlan is bound to a field that is smaller than the size of
the field in [Action Plans], I'm fresh out of ideas... sorry!

John W. Vinson[MVP]
 

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