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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Where/Like syntax prob

Status
Not open for further replies.

benwah

Technical User
Jun 27, 2001
97
GB
Hi I am using a query in Access 97 to select postcodes that begin with a particular combination (eg UB1, UB2 W5, W6 etc). The user, via a form, selects which combo it will be. How will the SQL code look? This is what i have at the moment but it is obviously wrong...

SELECT DPPF.refnum
FROM DPPF

WHERE (((DPPF.DateClosed) Is Null) AND ((DPPF.AppPostalCode) Like "[Forms]![frmWhatDates]![postcode]*"))

ORDER BY DPPF.DateClosed;

It doesnt like the "[Forms]![frmWhatDates]![postcode]*" part and I know it must be a simple error in my syntax but i have no experiance using SQL so i have no idea!

Thanks in advance
wah
 
Replacing the exclamation marks with <> might work. I'm not positive, but I think certain DBMS do not support ! as 'not equal to', but they usually support <>.
&quot;Much that I bound, I could not free. Much that I freed returned to me.&quot;
(Lee Wilson Dodd)
 
the '!' in the '[Forms]![frmWhatDates]![postcode]' statement basically points to the 'postcode control' (could be described as a variable i guess...) of the 'frmwhatdates' 'form' which is a form that the user enters the postcode on. I have used similar statements in SQL before without a prob ie:

Is Not Null And Between [Forms]![frmWhatDates]![startdate] And [Forms]![frmWhatDates]![enddate]

I hope that makes it clearer...

thanks again,
wah
 

wah,

I suggest posting your question in one of the Access forums. Similar questions have been answered numerous times by the Access experts. You'll get an answer faster in one of the following forums.

Microsoft: Access - General discussion
Microsoft: Access Modules (VBA Coding)
Microsoft: Access Forms
Microsoft: Access Queries and Access/SQL
Terry Broadbent


&quot;The greatest obstacle to discovery is not ignorance -- it is the illusion of knowledge.&quot; - Daniel J Boorstin
 
yeah i have tried but not getting much response from there...
 
so long ago! I'll have a looksee... in the meantime you may want to remind me at ben.robb@ealing.gov.uk

cya
wah
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top