In a form, I have a button with the following sub onClick:
Private Sub btn_both_Click()
DoCmd.OpenReport "R_products", acViewPreview
DoCmd.GoToRecord acDataForm, "F_products", acNewRec
End Sub
But when I click on the button, that 2046 error occurs, "The command or action 'GotoRecord" isn't available now"
Interestingly, if I run that two DoCmd in 2 buttons separately in the form with the following code, they all works fine.
Please help! Thanks a lot!
Private Sub btn_both_Click()
DoCmd.OpenReport "R_products", acViewPreview
DoCmd.GoToRecord acDataForm, "F_products", acNewRec
End Sub
But when I click on the button, that 2046 error occurs, "The command or action 'GotoRecord" isn't available now"
Interestingly, if I run that two DoCmd in 2 buttons separately in the form with the following code, they all works fine.
Private Sub btn_New_Click()
DoCmd.GoToRecord acDataForm, "F_products", acNewRec
End Sub
Private Sub btnRpt_Click()
DoCmd.OpenReport "R_products", acViewPreview
End Sub
it seems that that two DoCmd can't be running in a same precedure or I missed something?DoCmd.GoToRecord acDataForm, "F_products", acNewRec
End Sub
Private Sub btnRpt_Click()
DoCmd.OpenReport "R_products", acViewPreview
End Sub
Please help! Thanks a lot!
Last edited: