New use for combo box ...

expublish

Registered User.
Local time
Today, 16:38
Joined
Feb 22, 2002
Messages
121
On all my forms the user needs to be able to print record, add record, delete record and save record. I alrerady have command buttons for go to next/previous and exit form. I don't like the idea of having a row of 7 command buttons along the bottom of every page. Anyone know how to put all those functions into a combo box?
This would look a lot better. I was thinking along the lines of web pages but am unsure if possible in a DB form.
Thanks in advance.
 
Create your own Menu Bar and attach it to the form. Check out the Help files.
 
In the end I took Fizzios advice. It looks like this:

--

Create a table with Autonumner and Command description. Type in command descriptions you want availale in the table (remember the ID number assigned to it)

Set the rowsource to
SELECT [tlkpCommands].[CommandID], [tlkpCommands].[ScreenDisplay] FROM tlkpCommands; where tlkpCommands is the table, CommandID is the autonumber field, ScreenDisplay is what you want to display on screen.

On the Afterupdate event (or via another command button)
Private Sub cboSelectCommand_AfterUpdate()
Select Case Me.cboSelectCommand.Value

Case 1 'Print Record
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.PrintOut acSelection

Case 2 'Create New Record
DoCmd.GoToRecord , , acNewRec

Case 3 'Delete Record
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70

Case 4 'Save Record
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

End Select
End Sub

NB Case number corresponds to the Autonumber field in the lookup table.
 
Please consider only posting your topic once in the most appropriate Forum. Duplicate posts lead to duplicate effort, and as you said, Fizzio provided you with good help.

Just an FYI,
David R
 
Couple of thoughts (A) DoMenuItem is virtually obsolete , use the Run Constants of the DoCmd if you want to continue with this idea, of course if you used buttons you could just put Me.Recalc to replace DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
(B) There's no error handling
(C) Access has no chance of using its optimisation methods, I hope you don't have large recordsets.
 
I used this code purely as an experiment and I totally agree Rich with the error handling. I actually set up buttons and ripped the code. Cheating I know but hey it works and I just had to see if I could make it work - Beta software if you like !
smile.gif
 

Users who are viewing this thread

Back
Top Bottom