Thanks Aivars, I want to change my first idea to this: A Warning MSG BOX to the end user, once they changed the Rank pulldown field DON'T FORGET TO CHANGE THE PAYGRADE PULLDOWN TO!!!
Rank is your Job position, example ET2. PayGrade is your pay level, example E5. So a ET2 is the same same being an E5. They must match...
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim rst As Recordset
If IsNull(Me.Rank_tbl_ID) And IsNull(Me.PG_tbl_ID) Then
MsgBox "You may update..."
'or do.....
'or ignore it... and exit sub
'otherwise
Cancel = True
Exit Sub
End If
If IsNull(Me.Rank_tbl_ID) Or IsNull(Me.Rank_tbl_ID) Then
Set rst = CurrentDb.OpenRecordset("Select PG, Rank from MyTable;"
If IsNull(Me.PG_tbl_ID) Then
rst.FindFirst "Rank='" & Me.Rank_tbl_ID
rst.Edit
Me.PG_tbl_ID = rst!PG_tbl_ID
rst.Update
ElseIf IsNull(Me.Rank_tbl_ID) Then
rst.FindFirst "PG_tbl_ID='" & Me.PG_tbl_ID
rst.Edit
Me.PG_tbl_ID = rst!PG_tbl_ID
rst.Update
End If
rst.Close
Set rst = Nothing
End If
End Sub
Rank is your Job position, example ET2. PayGrade is your pay level, example E5. So a ET2 is the same same being an E5. They must match...
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim rst As Recordset
If IsNull(Me.Rank_tbl_ID) And IsNull(Me.PG_tbl_ID) Then
MsgBox "You may update..."
'or do.....
'or ignore it... and exit sub
'otherwise
Cancel = True
Exit Sub
End If
If IsNull(Me.Rank_tbl_ID) Or IsNull(Me.Rank_tbl_ID) Then
Set rst = CurrentDb.OpenRecordset("Select PG, Rank from MyTable;"
If IsNull(Me.PG_tbl_ID) Then
rst.FindFirst "Rank='" & Me.Rank_tbl_ID
rst.Edit
Me.PG_tbl_ID = rst!PG_tbl_ID
rst.Update
ElseIf IsNull(Me.Rank_tbl_ID) Then
rst.FindFirst "PG_tbl_ID='" & Me.PG_tbl_ID
rst.Edit
Me.PG_tbl_ID = rst!PG_tbl_ID
rst.Update
End If
rst.Close
Set rst = Nothing
End If
End Sub