Adding a new record

echorley

Registered User.
Local time
Today, 17:07
Joined
Mar 11, 2003
Messages
131
This seems to happen to me a lot.

I use a command button to check various parameters, then open another form based on these parameters. However, I cannot seem to get the current form I am on to add a new record.

Here is the code I am using that is part of a command button:

If Me.Team_Fumbled = 1 And Me.Team_Recovered = 2 And Me.Returned_To <> 0 Then

strMsg = "Fumble on the Kickoff Return. Recovered by " & Me.Opponent
MsgBox (strMsg)
DoCmd.OpenForm "Defense Game Input Screen"
Forms![Defense Game Input Screen]![Quarter] = Me.Quarter
Forms![Defense Game Input Screen]![Yardline] = Me.Returned_To
Forms![Defense Game Input Screen]![Side of Field] = Me.Returned_To_Side

'Here is the code that should add a new record:

DoCmd.GoToRecord acDataForm, "Fumble on Kickoff Return", acNext

DoCmd.Close acForm, "Fumble on Kickoff Return"
Exit Sub
End If

I have tried:

DoCmd.GoToRecord acDataForm, "Fumble on Kickoff Return", acNewRec

and

DoCmd.RunCommand acCmdRecordsGoToNew

None of these will add a new record. This form is a popup and is modal. Any suggestions?
 
You could try
Code:
Me.YourControl.SetFocus
DoCmd.GoToRecord , , acNewRec
Make sure the forms properties 'Allow Additions' = Yes

IMO
 
Last edited:
Got it

I did a bit more digging on the site and found the following solution:

In the Properties menu, set Data Entry to Yes.

Why the default would be No, I haven't a clue.

Thanks!
 

Users who are viewing this thread

Back
Top Bottom