Hi Again Steve
When I got home I checked the group macros and spelling and everything was
correct. Also what I said a about Report Listing name I was wrong that was
when I was trying it your way which did not work. The listbox done copying
the Classroom Management Database was name lstReport. As I was getting
nowhere I decided to convert the macros within Classroom Management template
to see if it would make more sence to you if you see it in Visual basic
format so here goes
------------------------------------------------------------------------------------------------
View_Report_Macros_cmdOpenReport___On_Clic
------------------------------------------------------------------------------------------------
Function View_Reports_Macros_cmdOpenReport___On_Click( )
On Error GoTo View_Reports_Macros_cmdOpenReport___On_Click_Err
DoCmd.OpenReport Forms ! [View Reports] ! lstReports, acViewPreview, "", "",
acNormal
View_Report_Macros_cmdOpenReport___On_Click_Exit:
Exit Function
View_Report_Macros_cmdOpenReport___On_Click_Err:
MsgBox Error$
Resume View_Report_Macros_cmdOpenReport___On_Click_Exit
End Functio
------------------------------------------------------------------------------------------------
View_Reports_Macros_EditReportList___On_Clic
------------------------------------------------------------------------------------------------
Function View_Reports_Macros_EditReportList___On_Click( )
On Error GoTo View_Reports_Macros_EditReportList___On_Click_Err
DoCmd.OpenForm "Reports", acFormDS, "", "", , acNormal
View_Reports_Macros_EditReportList___On_Click_Exit:
Exit Function
View_Reports_Macros_EditReportList___On_Click_Err:
MsgBox Error$
Resume View_Reports_Macros_EditReportList___On_Click_Exit
End Functio
-----------------------------------------------------------------------------------------------
View_Reports_Macros_lstReports___On_Dbl_Clic
-----------------------------------------------------------------------------------------------
Function View_Reports_Macros_lstReports___On_Dbl_Click( )
On Error GoTo View_Reports_Macros_lstReports___On_Dbl_Click_Err
DoCmd.OpenReport Forms ! [View Reports] ! lstReports, acViewPreview, "", "",
acNormal
View_Reports_Macros_lstReports___On_Dbl_Click_Exit:
Exit Function
View_Reports_Macros_lstReports___On_Dbl_Click_Err:
MsgBox Error$
Resume View_Reports_Macros_lstReports___On_Dbl_Click_Exit
End Function
Does this make anymore sense to you now it's in Visual Basic. I hope so
because I am totally lost I guess I am going to have to study up on Visual
Basic more throughly. I really need for this to work. Again all spelling
was checked and as far as I can see everything was right. I hope you can
figure this out and get back to me. I don't know what else to do other than
attaching a macro for each individual report within the list which if you
have say 15 standard reports would be 15 macro command buttons to setup which
is a lot.
Wendy
Steve Schapel said:
Wendy,
I am sorry, I can't give a definitive answer here. But it is sure to be
some little details somewhere not right.
I am not saying this is the problem... I don't know what the effect
would be. But I would not use a : as part of the name of a macro (or
any other database object for that matter).
Also, I would not use the Dbl Click event of a listbox. Is that what
they did in the database template you were basing your work on?
The other thing I noticed is the inconsistency in the naming in the
information you gave here. For example, you said in your descripion
that the listbox is named "Report listing", whereas in the macro details
you show it as "lst Reports", yet further down you say it is named
"lstReport". 3 completely different names for the same thing. You are
probalbly just being careless in your posting here, but accuracy with
these types of details are critical, so it makes me wonder whether the
problem lies with a spelling mistake somwhere along the line.
--
Steve Schapel, Microsoft Access MVP
Wendy said:
Hi Steve
The List box has been put directly onto the form, sorry I don't know why I
said on a subdata sheet, but I am still having problems, I tried your
surgestion but it did not work. It said it could not find the report named
Report listing which is what I called my listbox with my reports listed in
it. I tried several times following your instruction carefully each time
still no joy. I got the message switch form out of string space what ever
that means. So I decided to go back to the example that does work in the
template Classroom Management database and see if I could figure out how that
one worked. I followed everything that was set up in that database and did
the same just substituting my listing and named reports etc instead but
basically using everything else the same the following is how it is set up.
the list box was made from a table/query with the row source as 'Add or
Delete Reports' which is what the query was saved as. It had a default value
set up so I did the same from my lists of reports.
A group macro named View Reports Macros was made up of the following macro
names and actions:
Name Action Report Name:
cmdOpenReport : On Click OpenReport =[Forms]![View
Reports]![lst Reports] (view: print preview, window mode: Normal)
EditReportList : On Click OpenForm Reports
(View: Datasheet, Data mode: Edit, Window mode: Normal)
lstReports : On Click OpenReport =[Forms]![View
Reports]![lst Reports] (View: print preview, Window mode: Normal)
the command button for previewing the report chosen was named cmdOpenReport
with the caption &Open Report
the command button for editing the listing was named EditReportList with the
caption as &Edit Report List....
the listbox was named lstReport
In the on click section of the command button field options was typed:
View Report Macros.cmdOpenReport : On Click
In the list box field option for on Dbl Click was typed:
View Reports Macros.lstReport : On Click
In the on Click field options for th command button of the edit report was
typed:
View Reports Macros.EditReportList : On Click
As I said other than subsituting my set for the other it should have worked
but it did'ent I got the message Switch Board Form A problem occurred white
switchboard form was communicating with the OLE Server or ActiveX control
Close the OLE server & restart it outside of switch board form then try the
original operation again in switch board form. each time a tried to execute
the command. What it wrong with it, it should work but it dos'ent. I am
ready to give up on this. Please help.