Database Query problem

M

Mac@440th

I am currently using an Access database built entirely using FP
Database Wizard (version: FP 2003). I have created a page (Page2)
displaying data using the Insert --> Database --> Results
functionality. The custom query I'm using is:

SELECT * FROM UMD WHERE AFSC like '::partAFSC::';

I also have a page (Page1) where a the user fills out a form with the
field 'PartAFSC'. When the form is submitted, I call an 'onSubmit'
script that concatenates an asterisk "*" to the PartAFSC field, thus
the user enters, for example, '037' and Page2 receives '037*'.
However, when the query on Page2 is committed, I get the message 'No
records found.' I know records do exists, as I can run the query
directly in Access using the following query:

SELECT * FROM UMD WHERE AFSC like '037*'

and get the data I need. I am obviously doing something wrong, but
can determine, what exactly, I is wrong. Any suggestions, ideas, etc.

Thanks in advance!
 
T

Thomas A. Rowe

Try:

SELECT * FROM UMD WHERE AFSC LIKE '%" & PartAFSC & "%'

And DO NOT add the * to the search string
--
==============================================
Thomas A. Rowe
Microsoft MVP - FrontPage

http://www.Ecom-Data.com
==============================================
 
J

Jon Spivey

Hi,
You need to use % for like instead of * when you use Access on the web.
SELECT * FROM UMD WHERE AFSC like '037%'

Cheers,
Jon
 

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