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

query not working

Status
Not open for further replies.

SiJohn101

Technical User
Joined
Nov 13, 2001
Messages
13
Location
GB
I have this query but it comes up with an Expected end of statement fault. Here is the query

strSQL1 = "SELECT * FROM tblPRICEBANDS, tblCOTTAGES WHERE tblPRICEBANDS.fldPRICEBAND = tblCOTTAGES.fldPRICEBAND AND tblPRICEBANDS.fldPRICEBAND = '" & strPRICEBAND "' & tblCOTTAGES.fldPROP_NO = '" & strPROP_NO '"


Here is the line from the previous page which passes the information accross

<A HREF="test3.asp? NO =<%=objRs("fldProp_NO")%> & PB =<%=objRs("fldPriceband")%>">More Info</A></td>

 
Missing quotes in the end

strSQL1 = "SELECT * FROM tblPRICEBANDS, tblCOTTAGES WHERE tblPRICEBANDS.fldPRICEBAND = tblCOTTAGES.fldPRICEBAND AND tblPRICEBANDS.fldPRICEBAND = '" & strPRICEBAND "' & tblCOTTAGES.fldPROP_NO = '" & strPROP_NO '" [highlight]"[/highlight]

-VJ
 
It now says expected end of statement here

'" & strPRICEBAND "'

where the second double quote is
 
u have a typo:

Try this:

strSQL1 = "SELECT * FROM tblPRICEBANDS, tblCOTTAGES WHERE tblPRICEBANDS.fldPRICEBAND = tblCOTTAGES.fldPRICEBAND AND tblPRICEBANDS.fldPRICEBAND = '" & strPRICEBAND "' [highlight]AND [/highlight] tblCOTTAGES.fldPROP_NO = '" & strPROP_NO '" "

-VJ
 
It;s still saying expected end after strpriceband.

Although i pass it across as & PB =<%=objRs("fldPriceband")% in my database priceband is a numeric field does this have any bearing
 
try this:

strSQL1 = "SELECT * FROM tblPRICEBANDS, tblCOTTAGES WHERE tblPRICEBANDS.fldPRICEBAND = tblCOTTAGES.fldPRICEBAND AND tblPRICEBANDS.fldPRICEBAND = '" & strPRICEBAND "' AND tblCOTTAGES.fldPROP_NO = " & strPROP_NO

-VJ
 
No it still won't get passed strpriceband
 
if you are passing variables like this:

<A HREF="test3.asp? NO =<%=objRs("fldProp_NO")%> & PB =<%=objRs("fldPriceband")%>">More Info</A></td>

then try this:

strSQL1 = "SELECT * FROM tblPRICEBANDS, tblCOTTAGES WHERE tblPRICEBANDS.fldPRICEBAND = tblCOTTAGES.fldPRICEBAND AND tblPRICEBANDS.fldPRICEBAND = '" & request.querystring("PB")& "' AND tblCOTTAGES.fldPROP_NO = " & request.querystring("NO")


or

you can first collect the variables like this

PriceBand= Request.QueryString("PB")
PropNO= Request.QueryString("NO")

and then use these

strSQL1 = "SELECT * FROM tblPRICEBANDS, tblCOTTAGES WHERE tblPRICEBANDS.fldPRICEBAND = tblCOTTAGES.fldPRICEBAND AND tblPRICEBANDS.fldPRICEBAND = '" & PriceBand& "' AND tblCOTTAGES.fldPROP_NO = " & PropNo

Hope this helps

-VJ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top