Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Event procedure not "linking" forms consistently

Status
Not open for further replies.

Conner

Technical User
Nov 29, 2000
44
US
I have three forms -- a main form called "frmEveryone" and two other forms, one named "frmEmployee" and "frmStudent." These last two are not subforms.

On the main entry form (frmEveryone) there is a combo box with an event procedure. When you select either "employee" or "student" in the combo box, you are then taken by an event procdure to one of the other two forms -- frmEmployee or frmStudent.

My problem is this:The first time you enter data on an individual and get to the combo box where you choose either "employee" or "student," the event procdure opens an "empty" form. The SSN, Last Name and First Name of the employee do not appear in the form; however, If you go to another employee or close out the form, then reopen, this data appears? How do I make it appear when first opened?

Here is the event procedure I am using with the combo box:

Option Compare Database

Private Sub Classification_AfterUpdate()
If Me.Classification="Employee" Then
DoCmd.OpenForm "frmEmployee,acNormal, ,
"[tblEveryonebio].[SSN]='"& Me.SSN & "'"
Me.Classificaton.Requery

Else
DoCmd.OpenForm "frmStudent", acNormal,,
[tblEveryoneBio}.[SSN}=' " & Me.SSN & "'"

End If

End Sub










 
I've had a similar problem in the past. I think you need to add a line of code before the If statement to sace the record.

HTH

Jane
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top