Click to See Complete Forum and Search --> : VBA -Access opening different reports


jen
February 16th, 2000, 01:56 AM
Hi!
I´m new to VBA and I need help. I have 2 tables with suppliers and products. I want to print out different reports of products depending on their suppliers. I begin with opening a form to get the article from user and to select which supplier supplies it. I have used a loop to recieve names of existing reports and they have the same name as the supplier. But I would like to send to report the data of the article and without needing to prompt the user about it again. How can I do that?


DoCmd.OpenForm "for_report"


Dim obj as AccessObject, dbs as Object
set dbs = Application.CurrentProject

for Each obj In dbs.AllReports
If obj.Name = Forms!for_report!Supplier then

DoCmd.Close acForm, "for_report"
DoCmd.OpenReport obj.Name, acPreview, "", ""
End If
next obj




Thanks in advance
Jen