That is what I have now - but wanted to automate this input - which is
predefined
by doing this I was hoping to avoid input error on the parameter input.
Automate it how? Where would Access get the values from? If they are
always the same, just replace the parameters in your query with the values.
Not sure what you mean when you say they are predefined. Where?
Err_Command155_Click:
MsgBox Err.Description
Resume Exit_Command155_Click
End Sub
Each command button represents a department (pre defined department number
say ranging from 10 to 25)
The main form is based on the a table of all the deparments numbers
so when you click one of the command button you choose a department "say 10"
which bring up the department details
The sub form is based on all sales for that department, one of the filed is
deparment number , which is linked with the master and child to the main form
so any transaction on the sub form are filtered by the dep no on the main
form.
So coming back to my original thought was that when one of the the command
button on the main form is selected it would open up the main form with the
predefinded department number somewhere in the code above.
Just FYI, rather than have 18 buttons, you might think about building a drop
down box with the various ranges and then ONE button to click. Or have an
option group with the 18 ranges and one button to click. It would make your
form look cleaner, but even more important, it would result in ONE piece of
dynamic code instead of 18 pieces of stringent code.
The only reason i have it the way I have it at the moment is that the layout
of the command buttons presented type of a org chart - easier for users to
identify with the structure of the department layout.
Yes, that would be the right way to do it. And, consider what happens when a
new department is added, then you have to modify and redeploy.
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.