Jul 23 2007, 07:32 AM
Is there a way to make an existing form open on a new record? I now that there's some checkbox when doing a switchboard but I can't find that.
Jul 23 2007, 07:50 AM
Do you mean you want a existing form open up blank, so you can add a new record?
If so try:
Docmd.openform "YourFormNameHere", , acNewRec
Jul 23 2007, 07:52 AM
Thanks, but it is already on the switchboard. How do I do it there?
Jul 23 2007, 08:12 AM
You mean add a new button to the switchboard,
or modify the code of an existing button to:
Docmd.openform "YourFormNameHere", , acNewRec ?
If modify, open the switchboard in design mode, double click the button & on the window that opens up
look at the 'on-click' event. Click on that line to open up the code window.
Jul 23 2007, 08:20 AM
Actually, it is a buton on the main switchboard. Where do I find the code to do this? I've got a nested form, so the way thatI get to it is like this
L_Menu->Form that I want to open to new record.
Where do I do that? I cannot seem to find the code in the VB section.
Jul 23 2007, 08:28 AM
1. Open the form in design mode
2. double-click on the button in question, and the properties window will open up.
3. in the EVENTS list, look at the 'On-Click' event. It will have 'Event Procedure' on it.
4. Click on that line & to the right of that you will see [...]
5. click on the little [...] button
6. You will see the code
Jul 23 2007, 08:59 AM
Right now all I see is this
how do I edit that. All i get is this equation box.
Jul 23 2007, 09:10 AM
Click on the 'On-Click' event line and select 'Event Procedure'.
Then click on the [...] little button to the right of that.
Put the code:
Docmd.openform "YourFormNameHere", , acNewRec <<~~~ change the form name to what your real form name is
It appears you used the 'Switchboard Mangler' to create your switchboard. Its better, IMHO, to create the
switchboard like any other form. It gives you more control over what & how things work.
Edited by: Aquadevel on Mon Jul 23 10:12:29 EDT 2007.
Jul 23 2007, 09:16 AM
Yes, I did use switchboard manager. Can I still use the process you describe?
Jul 23 2007, 09:40 AM
to correct the button?
to create additional buttons?
I MUST Need more coffee, I JUST noticed you posted in the Excel Forum,
I hope same thing works.
I'm NOT an Excel guy
Edited by: Aquadevel on Mon Jul 23 10:55:50 EDT 2007.
Jul 23 2007, 10:01 AM
Me too. I had a long weekend.
Jul 23 2007, 12:28 PM
Is this an Excel or Access question?
If it's Excel I'll tell you straight away that DoCmd just doesn't exist in Excel VBA.
Jul 23 2007, 01:54 PM
Does Excel even have a 'switchboard mangler'?
Jul 23 2007, 02:04 PM
Eh, of course it doesn't but there seems to be some confusion in this thread.
It has after all been posted in the Excel forum.
Jul 23 2007, 02:55 PM
I'm not confused, I know where I think I am!
Aug 8 2007, 10:39 PM
I am trying to open an existing form with a command button. I want the form to open up blank. I tried the code you suggested, but it's not working. It still opens up populated rather than blank. Any ideas?
Here's the code behind the command button:
Private Sub New_Inspection_Click()
On Error GoTo Err_New_Inspection_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Inspection"
DoCmd.OpenForm stDocName, , acNewRec
What do you think is the problem???
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here