S
Steve
Hello,
I've got a query that has a column where I add an incrementing value. The
expression in that column looks like this:
secnum: IIf([oemmarkets].[printorder]=1 And
[marketapplications].[printorder]=1,clear([oemmarkets].[printorder]),nextnum
([oemmarkets.printorder]))
Where oemmarkets.printorder and marketapplications.printorder are other
columns in the query.
The code for clear() and nextnum() is:
Dim intNum As Integer
Public Function Clear(varV As Variant) As Integer
intNum = 1
Clear = intNum
End Function
Public Function NextNum(varV As Variant) As Integer
intNum = intNum + 1
NextNum = intNum
End Function
The purpose of all this is to add an incrementing number to records in the
query. When I run the query, it works fine, and I get what I want. If I use
this query to feed another query, I end up with goofy numbers in the secnum
column in the second query. Also, I have a report that is driven by this
query, and when I put the secnum variable in the report as hidden text box,
sub reports referencing that text box then give goofy values.
Can anyone explain this phenomenon? It's driving me crazy! I even tried
making the query maketable, and then using the table to feed reports and
queries with the SAME RESULTS. I thought maybe secnum or nextnum were
reserved words but they aren't.
Any ideas???
Thanks!
I've got a query that has a column where I add an incrementing value. The
expression in that column looks like this:
secnum: IIf([oemmarkets].[printorder]=1 And
[marketapplications].[printorder]=1,clear([oemmarkets].[printorder]),nextnum
([oemmarkets.printorder]))
Where oemmarkets.printorder and marketapplications.printorder are other
columns in the query.
The code for clear() and nextnum() is:
Dim intNum As Integer
Public Function Clear(varV As Variant) As Integer
intNum = 1
Clear = intNum
End Function
Public Function NextNum(varV As Variant) As Integer
intNum = intNum + 1
NextNum = intNum
End Function
The purpose of all this is to add an incrementing number to records in the
query. When I run the query, it works fine, and I get what I want. If I use
this query to feed another query, I end up with goofy numbers in the secnum
column in the second query. Also, I have a report that is driven by this
query, and when I put the secnum variable in the report as hidden text box,
sub reports referencing that text box then give goofy values.
Can anyone explain this phenomenon? It's driving me crazy! I even tried
making the query maketable, and then using the table to feed reports and
queries with the SAME RESULTS. I thought maybe secnum or nextnum were
reserved words but they aren't.
Any ideas???
Thanks!