recordset - where statement

  • Thread starter Thread starter Ginger
  • Start date Start date
G

Ginger

I have code where I need to loop through a recordset, doing
commands for each time through it. The first recordset must
reference a 2nd record set where the [branch] = rs!branch.

I can't seem to get the syntax correct on this. So far, I
am getting all the records instead of one.

Also, how do I open a report based on the same idea?

Thank you in advance,
Ginger
 
Ginger:

Opening or printing a report based on a filter (i.e. [branch] = rs!branch)
involves simply using a SQL where as part of the OpenReport method (last
parameter).

What you may be encountering with your WHERE not working is that if branch
is a text field rather than a number field, you need to concantate it
differently as in:

Number:

"[branch] = " & rs!branch

Text:

"[branch] = '" & rs!branch & "'"

Which delimits the brach with quotations as needed for a text value.
 
Thank you Steve! That is probably the problem, as although
it is a number, it is actually put in as a text field in
the table. I'll try that tomorrow!

Once again, thank you for your help!

Ginger
-----Original Message-----
Ginger:

Opening or printing a report based on a filter (i.e. [branch] = rs!branch)
involves simply using a SQL where as part of the OpenReport method (last
parameter).

What you may be encountering with your WHERE not working is that if branch
is a text field rather than a number field, you need to concantate it
differently as in:

Number:

"[branch] = " & rs!branch

Text:

"[branch] = '" & rs!branch & "'"

Which delimits the brach with quotations as needed for a text value.
--
Steve Arbaugh
ACG Soft
http://ourworld.compuserve.com/homepages/attac-cg

I have code where I need to loop through a recordset, doing
commands for each time through it. The first recordset must
reference a 2nd record set where the [branch] = rs!branch.

I can't seem to get the syntax correct on this. So far, I
am getting all the records instead of one.

Also, how do I open a report based on the same idea?

Thank you in advance,
Ginger


.
 
Back
Top