unable to add new records to Main Form except at EOF ( and BOF ) ?

liamfitz

Registered User.
Local time
Today, 18:03
Joined
May 17, 2012
Messages
240
I posted earlier, that unless I was at Record No.1 in a form's recordset, and clicked on the 'AddNew' button, I could not go to a blank/new record. Now it's only if I am at the last record in the recordset ??? It's clearly allowing additions, and this works well, so it's to do with where the pointer/cursor is in the recordset ( 'unseen' by the user ) that's affecting it . Any help appreciated. Thanks.
 
Okay, you lost me (and I'm sure others as well). What recordset and how are you trying to go to a blank record and what are you doing with the cursor which you think could be affecting it?

Are you using code? If so, post the code you are using. Don't assume that everyone has read some prior post and, even if they have, can remember what you've got.
 
Certainly. here's the sub :
Code:
Private Sub cmdClientsOpen_Click()
DoCmd.OpenForm "frmClients", acNormal
DoCmd.GoToRecord , , acNewRec
End Sub

this GoToRecord was working and opening on a new record, but now it's saying 'Run tim error 2105: You can't go to the specified record' ( on the DoCmd.GoToRecord line ) :confused:
 
You don't use DoCmd.GoToRecord when opening another form. DoCmd's are quite sensitive to what is active at the time. So, I would use this instead:

Code:
Private Sub cmdClientsOpen_Click()
   DoCmd.OpenForm "frmClients", acNormal
   Forms!frmClients.Recordset.AddNew
End Sub
 
Thank you Mr. Larson. I will inform you of the outcome of your suggestion tomorrow, when I try this.
 
You could also look up GoToRecord in VBA help and note the arguments available that let you specify the form for it to act on.
 
Thank you boblarson. Yet again your knowledge and expertise has proved invaluable. You're a very important and competent contributor to this forum, and helped me on many occasions. It works perfectly.
 

Users who are viewing this thread

Back
Top Bottom