E
E
I have a Access 2000 application that originally had 2-3 pages in which the
end user could enter data. The number of forms has grown to double digits
and promises to grow more. On each form the BeforeUpdate event has
essentially the same code. Since we are adding new fields to all the forms I
thought it would be wise to create a modul to call from each form so I would
only have to update the code in 1 module instead of the code for 10+ forms.
My problem is this:
the code makes several references to the name of the form
Partial code Ex:
If Me.Dirty Then
If MsgBox("You are about to exit the form. Do you want to save this
record?", vbYesNo + vbExclamation, "Save") = vbNo Then
DoCmd.RunCommand acCmdUndo
Else
Dim db As DAO.Database
Dim rst As DAO.Recordset
Set db = CurrentDb()
Set rst = db.OpenRecordset("Select * from tblEvent")
With rst
.AddNew
!PatID = Forms!frmICD!txtPatID
!ProcID = Forms!frmICD!txtICDID
!ProcType = "ICD Implant"
etc...
In the module, it will not allow me to use Me nor can i specifically
reference the form name since it will be different for each form. How do I
pass the form name as a variable to the module (instead of using me.dirty for
example)?
Sorry for the long post I'm trying to be thorough.
Regards,
end user could enter data. The number of forms has grown to double digits
and promises to grow more. On each form the BeforeUpdate event has
essentially the same code. Since we are adding new fields to all the forms I
thought it would be wise to create a modul to call from each form so I would
only have to update the code in 1 module instead of the code for 10+ forms.
My problem is this:
the code makes several references to the name of the form
Partial code Ex:
If Me.Dirty Then
If MsgBox("You are about to exit the form. Do you want to save this
record?", vbYesNo + vbExclamation, "Save") = vbNo Then
DoCmd.RunCommand acCmdUndo
Else
Dim db As DAO.Database
Dim rst As DAO.Recordset
Set db = CurrentDb()
Set rst = db.OpenRecordset("Select * from tblEvent")
With rst
.AddNew
!PatID = Forms!frmICD!txtPatID
!ProcID = Forms!frmICD!txtICDID
!ProcType = "ICD Implant"
etc...
In the module, it will not allow me to use Me nor can i specifically
reference the form name since it will be different for each form. How do I
pass the form name as a variable to the module (instead of using me.dirty for
example)?
Sorry for the long post I'm trying to be thorough.
Regards,