very novice question about event procedures

  • Thread starter Thread starter capri
  • Start date Start date
C

capri

Guest
I don't know very much about code. I have been able to copy examples and get certain features to work, by only modifying form or table names.

I have a switchboard where I would like to put a button that will open a Report. However I can't just cut and paste new code into the properties of this button. It seems that there is already an event procedure which I think is connected to other buttons on the switchboard. If I can figure out what code I need to open the report, how do I determine where to place it in the existing event procedure?

I wish I had the luxury of learning about VBA the proper way, but since I don't I'm hoping someone can answer my questions. Thanks.
 
I am not sure what you mean by "switchboard".

To accomplish what you want, simply create a button (or label) and place the code you want in the OnClick event of that button.

The command to open a report is:

DoCmd.OpenReport

Check the help files for exactly how to set it up. I was like you. I learned VBA on my own with the help files and forums like this. I have found both to be invaluable.

Good luck!
 
If you mean the default switchboard it's not as easy as that in fact it doesn't like changes to it. Create your own custom switchboard or look in the help file.
HTH
 
There is a database option during installation that governs what you see on creating a new control. You must load all wizards from the "Wizards" option.

Whether you also load "Advanced Wizards" is up to you, though I use the Chart Wizard and Documenter Wizard a lot. Also the Subform/Subreport Wizard. These latter three wizards are considered "advanced."

If you have the "Command Button" wizard then the issue of building an event routine to open a form when you click that button is pretty much automatic. One of the dialogues in the wizard even asks you which form you want to open.

Unless you have some odd system options or have "adjusted" your registry somehow, I don't see why you would have any trouble at all with this particular problem.

Perhaps you have disabled the wizards on your toolbox button-bar? They are controlled by the button next to the arrow button, 2nd from the left when the standard tool bar is in horizonal orientation. This button on your toolbox bar should appear to be "in" or "pressed" in order for all wizards to work.
 
Thanks for the suggestions.

What I did was copy the Northwinds switchboard a couple of times. The first one is my Main switchboard, then I have buttons on the Main switchboard that will bring up other switchboards (eg one for queries, one for forms, one for reports). The people who will be using this database are complete novices so I have to make it as easy to use as possible. I've even built detailed user instructions into the database so they can have a step-by-step guide on how to accomplish whatever they want to do. I want them to be able to get what they need at the click of a button or two. I've tried to anticipate all possibilities and that is why I need to have a flexible query and report so they can obtain information by simply looking for a word or phrase.

The_Doc_Man I followed your instructions but for some reason it's opening the query and not the report. I have a query titled "qryWordOrPhrase" and also a report titles "rptWordOrPhrase". The query has a parameter set so that when it is opened, the user keys in a word or phrase and all the records containing that word are returned. From that query I built a report. If I click on the report in the database window, a paramater box pops up, I key in the word (eg security) and the report that is produced shows all the records containing the word security. I don't want the users going anywhere near the database window in order to guard against accidents.

Too much thinking today...time to go, guess I'll tackle it again tomorrow. I wish I had more time to get into learning VBA, but my contract is up at the end of this month so my DB has to be up and running . Unless I can find another postions where I get to use Access, guess it will be back to spreadsheets for me. It's been really interesting visiting this site and learning from all the great people here.
 

Users who are viewing this thread

Back
Top Bottom