By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,501 Members | 2,861 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,501 IT Pros & Developers. It's quick & easy.

Opening up a form with it going to a new blank entry

P: 12
I would like appreciate some help on a issue I am having at the moment.

On "Form1" I have a button which opens up "Form2". "Form2" is used to enter in GP data. The issue is that When "Form2" opens, it always goes to the first GP in the table. Is there anyway which I can make it so when "Form2" loads, it automatically goes to create a new blank record instead of going to the first record in the table?

I've posted up the Form_Load code from "Form2". What do I need to change in order for it to automatically go to a new blank entry?

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  3.     Dim rs As DAO.Recordset
  5.     Set rs = Me.RecordsetClone
  6.     If IsNull(Forms.Item("Form1").Controls.Item("GPCombo")) Then
  7.         DoCmd.GoToRecord , , acNewRec
  8.     Else
  9.         rs.FindFirst ("GPID=" & Forms.Item("Form1").Controls.Item("GPCombo"))
  10.     End If
  13.     If rs.RecordCount > 0 Then
  14.         Me.Bookmark = rs.Bookmark
  15.     End If
  17. End Sub
Can someone explain and breakdown what the code above does please?

Thank you soooooo much!
Feb 1 '08 #1
Share this Question
Share on Google+
1 Reply

P: 12
Ok. I've been searching around and I found out how to make it automatically go to a new record entry.
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Open(Cancel As Integer)
  2.         DoCmd.GoToRecord , , acNewRec
  3.     End If
  4. End Sub

Now another question comes about.

How do I make it so if there is already a selection in a combo box on "Form1", that it'll open up "Form2" to modify that GP Details. while if the combo box on "Form1" is empty, it'll go to a new record?

Do I use the IsNull or IsEmpty command for combo boxes?
Feb 1 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.