New Record Button

S

storlogic

Hello

I want to add a button to my switchboard that, when clicked, opens up a
blank record. Currently, I have to click on the button that is used to
"edit" a record and then click on (at the bottom) the * at the bottom of the
edit screen to create a new record.

I hope this makes sense.

I'd appreciate any suggestions.
 
S

Stockwell43

Hi storlogic,

You are using a form for inputting your information correct? I would think
you would have a button on your switchboard to open your form. If so, open
your form in design view, open the forms properties, scroll down to On Open
event, select Event Procedure from the drop down and click on the three dots
(...) and place this in above the End Sub

DoCmd.GoToRecord , , acNewRec

When you click the button to open your form, the form should open on a new
record.
 
S

Sninkle

Go into the switchboard Manager (Tools -> Database Utilities -> Switchboard
Manager), once this opens, double click the "Main Switchboard (default)".
Select New. Enter a name (this will be shown on the switchboard), from the
Command field choose "Open Form in Add Mode" and then choose the form.

This will make it so they can ONLY add a new entry. I would recommend
adding another option to the switchboard to open the form in Edit mode so
that the data can be looked at.
 
L

Lillian

Stockwell43 said:
Hi storlogic,

You are using a form for inputting your information correct? I would think
you would have a button on your switchboard to open your form. If so, open
your form in design view, open the forms properties, scroll down to On
Open event, select Event Procedure from the drop down and click on the
three dots (...) and place this in above the End Sub

DoCmd.GoToRecord , , acNewRec

When you click the button to open your form, the form should open on a new
record.


I would add more:

Me.AllowAdditons = True
DoCmd.GoToRecord , , acNewRec
me.firstFieldName.setfocus

then set the tab order
That way when you click on the button it will also set the focus you want.




I also put this in the "on exit" of each field to lock it so users don't
make accidents.

Me.AllFieldNames.Locked = True

Could put all of these in the forms "On Load" and just click a save button
that closes and opens the form.

Add this to the forms "on load" too to stop accidents by users.

ME.AllowAditions = False


One more step. If you are using a primary key that must be entered, In
the "On KeyPress" of each field name:

If IsNull(Me.MyPrimaryKeyField) or Me.MyPrimaryKeyField) = "" Then
MsgBox "There is no Primary Key entry. Enter one please."
Docmd.cancelEvent
Goto Exit1
End If
Exit1:

I also would add this to the Primary Key Field on Click.

Me.AllOfMyFields.Locked = False

That way if users need to edit any mistakes they can just click and go for
it.


This will stop the Primary Key violation when users accidently enter a new
record and add some unwanted data with no primary key entered. This was a
pain for along time but no longer. You can use the Esc Key to get out, if
you can get the user to find the Esc Key that they never have used before.
I had many hours of communication with this one.
Can you see the keyboard? Yes
Do you know your left and right hand fully? Yes
Is your keyboard black? If they say yes, I know that they can see the
keyboard.
Can you see the Esc Key on the top left of the keyboard? No.
I'll be in your office within the hour!



When you click the New Record Button. Halalluia.......Magic!
 
S

storlogic

Thank you to all !!! I'll give this and the other's above a try and see
which one I like best.

Thanks again for your suggestions and prompt responses.
 

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.

Ask a Question

Top