Still have some problems....

Results 1 to 3 of 3

Thread: Still have some problems....

  1. #1
    Rita Poon Guest

    Default Still have some problems....

    I have 2 SQLs<BR>In the first SQL, the results are stored in recordset1.<BR>In the second SQL, I want to select the anwser from recordset1.<BR>This the SQLs I wrote:<BR>SQL1="SELECT Bus_No FROM Est_Bus WHERE Estate_ID=1"<BR>Results are stored in rs1<BR>SQL2="SELECT Sch_Bus FROM Sch_Bus WHERE Sch_Bus=&#039;" & rs1("Bus_No")&"&#039; AND School_ID=1"<BR>But it doesn&#039;t work.<BR>Can you give me a solution?<BR><BR>

  2. #2
    Try this Guest

    Default RE: Still have some problems....

    What is your error message?<BR><BR>otherwise try this<BR>SQL2 = "SELECT Sch_Bus FROM Sch_Bus WHERE School_Id=1 AND Sch_Bus = " & rs1("Bus_No")

  3. #3
    Medieval Dude Guest

    Default RE: Still have some problems....

    Okay, I don&#039;t think that will work at all, and I wish I hadn&#039;t posted to someone earlier saying that something like this would work. The problem is that the code isn&#039;t waiting to get rs1 before charging ahead with the next SQL query. What I would do to solve this problem is combine the two queries together using a JOIN, like this:<BR><BR>SQL1="SELECT Bus_No, Sch_Bus FROM Est_Bus JOIN Sch_Bus ON Sch_Bus.Sch_Bus = Est_Bus.Bus_No WHERE Estate_ID=1"<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts