multiple recourd sources for a report

G

Guest

Hello there

I have a report that has multiple record sources used on it, depending from where the report is launched. For example, if the report is opened from the "Area" screen then the area's query is used. If the report is opened from the District screen then the district query is used.

Problem: I want to use a specific recordsource for a report based on what screen is open. How can I do this

I have tried
if
formname.visible then recordsource ="a
else if formname.visible then recordsource = "b
end i

when i tried this i got an error saying that the app couldn't find the form

Any suggestions? Is there an open arguement. For example, if formname is open then....

many thanks

Carlee
 
N

Niels

Hi Carlee,
if
formname.visible then recordsource ="a"
else if formname.visible then recordsource = "b"
end if

when i tried this i got an error saying that the app
couldn't find the form.

In cases like this i use my own FormExist-Methode

Function FormExists(FormularName As String) As Boolean
Dim f As Form
Dim Gefunden As Boolean
Dim index As Integer

Gefunden = False
index = 0
While (Not Gefunden And index < Forms.Count)
Set f = Forms(index)
If f.FormName = FormularName Then
Gefunden = True
End If
index = index + 1
Wend
FormExists = Gefunden

End Function

Hope it helps.
Niels
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top