K
kaosyeti
hey... i'm not very good at vba yet so i don't know where to start on this
issue. i have a report that needs to pull data from a couple of different
places, at different times. here's the breakdown:
i have a table that has sale data for all the sales consultants at one
location.
i have a report that needs to pull the number of sales for each sales
consultant
i need this report to be 'generic' enough not to have to hard-wire anyone's
name into the code.
what i'm think is sort of like this....
a function that pulls the first sales consultant's name from tblfinancelog
for the given time period...
then it stores that name in an array and pulls the next name from the table...
if the 2nd name is different, it stores it in the array as well...
and so on until only the sales consultants that actually have sales during
the time period are pulled...
then...
a textbox on the report that pulls the 1st name in the array...
another textbox on the report that pulls the 2nd name in the array...
etc until all names are pulled.
the absolute most sales consultants at any given location would be about 30..
many times it will be closer to 10.
this is what i TRIED to start with:
Private Function getslcns()
Dim slcn As String
Dim counter As Integer
Dim allslcns As String
counter = 0
slcn = DLookup("*", "tblfinancelog", "[date] between #" & Forms!
formquarterly!txtboxYTDstartdate & "# and #" & Forms!formquarterly!
txtboxYTDenddate & "#")
Do
Do While counter < 30
counter = counter + 1
allslcns = slcn & slcn
End Function
i'm absolutely willing to consider ANY alternative to my strategy that will
work. the end result is that i need a list of the names, one in each text
box and i'll be able to do other calculations off of each name to pull the
sales data myself.
thanks for looking.
issue. i have a report that needs to pull data from a couple of different
places, at different times. here's the breakdown:
i have a table that has sale data for all the sales consultants at one
location.
i have a report that needs to pull the number of sales for each sales
consultant
i need this report to be 'generic' enough not to have to hard-wire anyone's
name into the code.
what i'm think is sort of like this....
a function that pulls the first sales consultant's name from tblfinancelog
for the given time period...
then it stores that name in an array and pulls the next name from the table...
if the 2nd name is different, it stores it in the array as well...
and so on until only the sales consultants that actually have sales during
the time period are pulled...
then...
a textbox on the report that pulls the 1st name in the array...
another textbox on the report that pulls the 2nd name in the array...
etc until all names are pulled.
the absolute most sales consultants at any given location would be about 30..
many times it will be closer to 10.
this is what i TRIED to start with:
Private Function getslcns()
Dim slcn As String
Dim counter As Integer
Dim allslcns As String
counter = 0
slcn = DLookup("*", "tblfinancelog", "[date] between #" & Forms!
formquarterly!txtboxYTDstartdate & "# and #" & Forms!formquarterly!
txtboxYTDenddate & "#")
Do
Do While counter < 30
counter = counter + 1
allslcns = slcn & slcn
End Function
i'm absolutely willing to consider ANY alternative to my strategy that will
work. the end result is that i need a list of the names, one in each text
box and i'll be able to do other calculations off of each name to pull the
sales data myself.
thanks for looking.