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

SQL syntax 1

Status
Not open for further replies.

benwah

Technical User
Jun 27, 2001
97
GB
Hi I am using a query 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]![enddate]*"))

ORDER BY DPPF.DateClosed;

It doesnt like the "[Forms]![frmWhatDates]![enddate]*" 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
 
sorry this part:

"[Forms]![frmWhatDates]![enddate]*"

should read:

"[Forms]![frmWhatDates]![postcode]*"

still doesnt help any though! :(

wah
 

You need to remove the quotes (") around the control name and add the concatenation operator (&).

WHERE (((DPPF.DateClosed) Is Null) AND ((DPPF.AppPostalCode) Like [Forms]![frmWhatDates]![enddate] & "*"))
Terry Broadbent


"The greatest obstacle to discovery is not ignorance -- it is the illusion of knowledge." - Daniel J Boorstin
 
thanks terry that worked a treat!

wah
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top