Have got a mess ^&%$(*^

jim may

Well-known Member
Joined
Jul 4, 2004
Messages
7,486
I create a Form based on a query - Added a Command button to allow a New record to be added. It worked fine for a month or two, until I CHANGED something - to where now when I open the Form and Click on the Add New Record button, nothing happens -- At the bottom of the form I can see that the native "add new record" is greyed out. The user wanted the Records to be maintained in Alphabetic order (based on a calculated field combining the Church Name and City) which I did -- Everything works fine except when I need to add a new record. Can I modify the code below to use another query when I need to add new records? HELP!!!


Code:
Private Sub Command120_Click()

On Error GoTo Command120_Click_Err

    On Error Resume Next
    DoCmd.GoToRecord , "", acNewRec
    ChurchName.SetFocus
    If (MacroError <> 0) Then
        Beep
        MsgBox MacroError.Description, vbOKOnly, ""
    End If

Command120_Click_Exit:
    Exit Sub

Command120_Click_Err:
    MsgBox Error$
    Resume Command120_Click_Exit

End Sub
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
When you say you changed something, my guess is it isn't code related because the code is fine (although instead of using

On Error Resume Next

I would use this:
Code:
If Not Me.NewRecord Then
   DoCmd.RunCommand acCmdRecordsGoToNew
End If

But I digress...

The lack of being able to add a new record means that your underlying record source is probably nonupdatable. So, check that out first.
 
Upvote 0

Forum statistics

Threads
1,224,609
Messages
6,179,875
Members
452,949
Latest member
Dupuhini

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top