Pop-up Data Entry Form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have created a pop-up data entry form to enter new employees. That's
working great, however, is there a way that I can then have that new employee
be the record that is showing when I close the data entry form.

Right now, when I close the data entry form after entering the new employee,
the record that shows up is the first record in my database.

Any help would be appreciated (and I am not a programmer, so if you provide
code, please let me know precisley where to put it - thanks).

Thank you all!
Tanya Lee
 
In your pop up form's Close event, you can use the following code. You will
have to change the form and control names to match yours/

Private Sub Form_Close()

Dim rst As Recordset
Dim frm As Form

Set frm = Forms!MyFormName
Set rst = frm.RecordsetClone
rst.FindFirst "[EmployeeID] = '" & Me.txtEmployeeID & "'"
frm.Bookmark = rst.Bookmark
Set rst = Nothing
Set frm = Nothing

End Sub

Now, to complete the process so the selected record will be displayed in
your main form, you will need to add one line to the Activate event:

Me.Repaint
 
I'm sorry, which are the control names I would have to change? I inserted
your code and changed the MyFormName to the name of my form (correct???), but
I am getting an error on this part:
& Me.txtEmployeeID & "'"

Unfortunately I don't understand what I'm reading so I don't understand the
error...can you help? (And Employee ID is the field name for my autonumber
for new employees).

Thank you so much!



Klatuu said:
In your pop up form's Close event, you can use the following code. You will
have to change the form and control names to match yours/

Private Sub Form_Close()

Dim rst As Recordset
Dim frm As Form

Set frm = Forms!MyFormName
Set rst = frm.RecordsetClone
rst.FindFirst "[EmployeeID] = '" & Me.txtEmployeeID & "'"
frm.Bookmark = rst.Bookmark
Set rst = Nothing
Set frm = Nothing

End Sub

Now, to complete the process so the selected record will be displayed in
your main form, you will need to add one line to the Activate event:

Me.Repaint

Tanya Lee said:
I have created a pop-up data entry form to enter new employees. That's
working great, however, is there a way that I can then have that new employee
be the record that is showing when I close the data entry form.

Right now, when I close the data entry form after entering the new employee,
the record that shows up is the first record in my database.

Any help would be appreciated (and I am not a programmer, so if you provide
code, please let me know precisley where to put it - thanks).

Thank you all!
Tanya Lee
 
Back
Top