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!