i have a dataentry form for managing persons from which i by products.
The form has as recordset : "tblLeveranciers". I can navigate from the first record in this table to the last and vice versa, and make changes to the data , save this changes and undo changes. Even when i click the button to add a new record, i get a form ready to enter new data, but when i try to save this data or undo the imput by clicking on the button "Save" or button "Undo", the form gets frozen and i'm oblige to get out of access via a unconventional manner. The strange thing about this story is that i have pratically the same form with the same code to manage clients, and there everything i going very well. There's no difference in the code of both forms to add a new record, undo the changes or save the new record! For this reason i checked the table as well as the qry's i use in the form, but i can't see any thing that can be the reason for this behavior. i use a qry to filter the form on opening, so that the same form can be used for current as welle as for ex delivery persons. I checked the result of this queries, and also that was OK. Beneath the code linked to the button "Save'" and the code linked to the button "undo"
Private Sub CmdOpslaan_Click()
On Error GoTo Error_Handler
If Me.Dirty Then
Me.Dirty = False
Me!Bookmark = Bladwijzer
End If
If Me.OpenArgs = "Current" Then
Me!cboZoekViaLevNr.Visible = True
Me!cboZoekViaExLevnr.Visible = False
Me!cboZoekViaLevNaam.Visible = True
Me!cboZoekViaExLevNaam.Visible = False
Me!CmdNieuw.Enabled = True
Me!CmdWijzigen.Enabled = True
ElseIf Me.OpenArgs = "Ex" Then
Me.CmdNieuw.Enabled = False
Me!cboZoekViaLevNr.Visible = False
Me!cboZoekViaExLevnr.Visible = True
Me!cboZoekViaLevNaam.Visible = False
Me!cboZoekViaExLevNaam.Visible = True
Me!lblExLev.ForeColor = 0
End If
Afsluiten:
On Error GoTo 0
Exit Sub
Error_Handler:
Call HandleError(Err.Number, Err.Description, "CmdOpslaan_Click", "frmLeveranciers")
Resume Afsluiten
End Sub
Private Sub CmdCancel_Click()
On Error GoTo Error_Handler
Application.Echo False
If Me.Dirty Then
DoCmd.RunCommand acCmdUndo
End If
If Me.NewRecord Then
Me.Bookmark = Bladwijzer
Me!CmdWijzigen.Enabled = True
Me!CmdSluiten.Enabled = True
End If
Me!cboZoekViaLevNr.Locked = False 'nodig anders na cmdnieuw en cmdcancel gelocked
Me!cboZoekViaLevNaam.Locked = False ' idem
Me!lblExLev.ForeColor = 0
If Me.OpenArgs = "Current" Then
Me!cboZoekViaLevNr.Visible = True
Me!cboZoekViaExLevnr.Visible = False
Me!cboZoekViaLevNaam.Visible = True
Me!cboZoekViaExLevNaam.Visible = False
If Me!CmdNieuw.Enabled = False Then
Me!Cmd!Nieuw.Enabled = True
End If
ElseIf Me.OpenArgs = "Ex" Then
Me!CmdNieuw.Enabled = False
Me!cboZoekViaLevNr.Visible = False
Me!cboZoekViaExLevnr.Visible = True
Me!cboZoekViaLevNaam.Visible = False
Me!cboZoekViaExLevNaam.Visible = True
End If
Application.Echo True
Afsluiten:
On Error GoTo 0
Exit Sub
Error_Handler:
Call HandleError(Err.Number, Err.Description, "CmdCancel_Click", "frmLeveranciers")
Resume Afsluiten
End Sub
The form has as recordset : "tblLeveranciers". I can navigate from the first record in this table to the last and vice versa, and make changes to the data , save this changes and undo changes. Even when i click the button to add a new record, i get a form ready to enter new data, but when i try to save this data or undo the imput by clicking on the button "Save" or button "Undo", the form gets frozen and i'm oblige to get out of access via a unconventional manner. The strange thing about this story is that i have pratically the same form with the same code to manage clients, and there everything i going very well. There's no difference in the code of both forms to add a new record, undo the changes or save the new record! For this reason i checked the table as well as the qry's i use in the form, but i can't see any thing that can be the reason for this behavior. i use a qry to filter the form on opening, so that the same form can be used for current as welle as for ex delivery persons. I checked the result of this queries, and also that was OK. Beneath the code linked to the button "Save'" and the code linked to the button "undo"
Private Sub CmdOpslaan_Click()
On Error GoTo Error_Handler
If Me.Dirty Then
Me.Dirty = False
Me!Bookmark = Bladwijzer
End If
If Me.OpenArgs = "Current" Then
Me!cboZoekViaLevNr.Visible = True
Me!cboZoekViaExLevnr.Visible = False
Me!cboZoekViaLevNaam.Visible = True
Me!cboZoekViaExLevNaam.Visible = False
Me!CmdNieuw.Enabled = True
Me!CmdWijzigen.Enabled = True
ElseIf Me.OpenArgs = "Ex" Then
Me.CmdNieuw.Enabled = False
Me!cboZoekViaLevNr.Visible = False
Me!cboZoekViaExLevnr.Visible = True
Me!cboZoekViaLevNaam.Visible = False
Me!cboZoekViaExLevNaam.Visible = True
Me!lblExLev.ForeColor = 0
End If
Afsluiten:
On Error GoTo 0
Exit Sub
Error_Handler:
Call HandleError(Err.Number, Err.Description, "CmdOpslaan_Click", "frmLeveranciers")
Resume Afsluiten
End Sub
Private Sub CmdCancel_Click()
On Error GoTo Error_Handler
Application.Echo False
If Me.Dirty Then
DoCmd.RunCommand acCmdUndo
End If
If Me.NewRecord Then
Me.Bookmark = Bladwijzer
Me!CmdWijzigen.Enabled = True
Me!CmdSluiten.Enabled = True
End If
Me!cboZoekViaLevNr.Locked = False 'nodig anders na cmdnieuw en cmdcancel gelocked
Me!cboZoekViaLevNaam.Locked = False ' idem
Me!lblExLev.ForeColor = 0
If Me.OpenArgs = "Current" Then
Me!cboZoekViaLevNr.Visible = True
Me!cboZoekViaExLevnr.Visible = False
Me!cboZoekViaLevNaam.Visible = True
Me!cboZoekViaExLevNaam.Visible = False
If Me!CmdNieuw.Enabled = False Then
Me!Cmd!Nieuw.Enabled = True
End If
ElseIf Me.OpenArgs = "Ex" Then
Me!CmdNieuw.Enabled = False
Me!cboZoekViaLevNr.Visible = False
Me!cboZoekViaExLevnr.Visible = True
Me!cboZoekViaLevNaam.Visible = False
Me!cboZoekViaExLevNaam.Visible = True
End If
Application.Echo True
Afsluiten:
On Error GoTo 0
Exit Sub
Error_Handler:
Call HandleError(Err.Number, Err.Description, "CmdCancel_Click", "frmLeveranciers")
Resume Afsluiten
End Sub