RUdebugged
New member
- Local time
- Today, 08:51
- Joined
- Nov 28, 2011
- Messages
- 5
Hello - forgive me if this does not constitute a new thread. It's my first post.
I am calling a subroutine from another sub, and creating a recordset from a simple select sql statement. What's completely baffling is why putting in the identical where condition twice works to get all 250 records, while putting in the where statement once, like you would in a query, returns just the first record. I did check the syntax in a new query (SQL view), and the 250 recs are returned with a single condition.
This returns only 1 record:
Whereas this returns 250 records:
Any ideas why the sql statement works differently in the subroutine or more specifically why the two Station = 'arf' conditions are necessary? Another little tidbit is that I get the 250 'arf' records with any two combinations in the condition, such as Station ='arf' or Station = 'car'.
I am calling a subroutine from another sub, and creating a recordset from a simple select sql statement. What's completely baffling is why putting in the identical where condition twice works to get all 250 records, while putting in the where statement once, like you would in a query, returns just the first record. I did check the syntax in a new query (SQL view), and the 250 recs are returned with a single condition.
This returns only 1 record:
Code:
Set rs1 = mydb.OpenRecordset("Select Station from tblList where Station ='arf';")
Whereas this returns 250 records:
Code:
Set rs1 = mydb.OpenRecordset("Select Station from tblList where Station ='arf' or Station = 'arf';")
Any ideas why the sql statement works differently in the subroutine or more specifically why the two Station = 'arf' conditions are necessary? Another little tidbit is that I get the 250 'arf' records with any two combinations in the condition, such as Station ='arf' or Station = 'car'.