Dlookup fields not able to undo

stretch66

Racing towards the start
Local time
Today, 00:01
Joined
Sep 28, 2005
Messages
72
Hi my second post!

Very new to VB and Access and am creating a HR database for work. Have created a Personal Details form and on click allows edits. Am using Dlookup fields for 'Position' and 'Grade' which sit under two text boxes on the Personal details form and are displayed when the Edit button is pressed so that I can use drop down lists.

Grade is dependant on Position and so a Criteria has been placed in the query. The problem that I have is when I try to do undo edit it does not recognise the Dlookup linked fields. The other problem with this is in the next stage I want to create an Audit trail form and if it cannot recognise that the fields have changed then I'm in trouble.

Would really appreciate any feedback/help.Thanx


Have included my code for the Personal Details/Edit form below:


Code:
Private Sub Command94_Click()
    Me.Position.Visible = True
    Me.Text90.Visible = False
    Me.Grade.Visible = True
    Me.Text92.Visible = False
    Me.Label95.Visible = True
    Me.Label62.Visible = False
End Sub

Private Sub Grade_AfterUpdate()
    Me.Text166.Requery
    DoCmd.SetWarnings False 'Turns off systems warnings for query
    DoCmd.OpenQuery "QRY_UPD_JOBID"
    DoCmd.SetWarnings True 'Turns system warnings back on
End Sub

Private Sub Position_AfterUpdate()
    
    Me.Grade.Requery 'Requeries grade
    Me.Grade.SetFocus
    RunCommand acCmdDelete
    Me.Text166.Requery
    
End Sub

Private Sub PersonnelDetailsEditButton_Click()
On Error GoTo Err_PersonnelDetailsEditButton_Click


    DoCmd.DoMenuItem acFormBar, acRecordsMenu, 0, 2, acMenuVer70

Exit_PersonnelDetailsEditButton_Click:
    Exit Sub

Err_PersonnelDetailsEditButton_Click:
    MsgBox Err.Description
    Resume Exit_PersonnelDetailsEditButton_Click
    
End Sub

Private Sub PDEditUndoBut_Click()
On Error GoTo Err_PDEditUndoBut_Click

If Me.Dirty Then
Beep
DoCmd.RunCommand acCmdUndo
Else
Beep
MsgBox "There were no modifications made to the current record.", vbInformation, "Invalid Undo"
End If

Exit_PDEditUndoBut_Click:
Exit Sub

Err_PDEditUndoBut_Click:
MsgBox Err.Number, Err.Description
Resume Exit_PDEditUndoBut_Click

End Sub
 
Last edited by a moderator:

Users who are viewing this thread

Back
Top Bottom