Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Syntax Error

Status
Not open for further replies.

makisbest

Technical User
Mar 3, 2005
125
GR
hi

Where is the error on this code

code
SELECT Table1.aa, Table1.bb
FROM Table1
WHERE (((Table1.aa) Like "'" & [Forms]![form1]![CoboBox0].[Text] & "%'"));
 
Should

[Forms]![form1]![CoboBox0].[Text]

be

[Forms]![form1]![ComboBox0].[Text]

?

Also check that field Table1.aa is a text field.

Regards

BuilderSpec
 
The
[Forms]![form1]![CoboBox0].[Text]

IS

[Forms]![form1]![ComboBox0].[Text]

and I also check that field Table1.aa is a text field.

but it dosnt work

Help Please
 
Change

SELECT Table1.aa, Table1.bb
FROM Table1
WHERE (((Table1.aa) Like "'" & [Forms]![form1]![CoboBox0].[Text] & "%'"));

to

SELECT Table1.aa, Table1.bb
FROM Table1
WHERE (((Table1.aa) Like '" & [Forms]![form1]![CoboBox0].[Text] & "%'"));

there was an extra " in the first one after "Like", i don; think it should be there..


Hope this helps!

Regards

BuilderSpec
 
What method of execution are you using? And what is happening, is there any error message, does it stop somewhere ...

Percent is usually wildcard for ADO, while DAO uses *

Which event are you using? Can we please see the whole code for this?

The text property of a combo, is whatever exists at the time of execution in the text part of the combo - in code the reference is more often like this

[tt]Forms!form1!CoboBox0.Text[/tt]

What one perhaps more often use, is the .Value property (or, as this is the default property, not specify anything at all), or pick a column from the combo (...cboMyCombo.Column(1) to get the second column)

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top