L
lhtan
I have two Forms: Legal Masterlist and Employee.
The recordsource for each form is "Legal Masterlist" Table and "Employee"
Table.
When I clicked a button in the "Legal Masterlist" form, it'll open up
another form called "Employee". After filling up the latter, a save button is
clicked to save the EmployeeID into the "Legal Masterlist" Table.
I have an Event Procedure for "onLoad" in the "Employee" form that declares
the database and recordset. There is also an "onClick" event procedure for
the save button in this form. Below is the code:
Private Sub Form_Load()
Dim dbsLegalDB As Database
Dim rstLegalMasterlist As Recordset
Set dbsLegalDB = OpenDatabase("LegalDB.mdb")
Set rstLegalMasterlist = dbsLegalDB.OpenRecordset("Legal Masterlist")
End Sub
*******************
Run-time error '3024'
Cannot find file 'LegalDB.mdb'
*******************
Above is the error that I encountered.
For the "onClick" event procedure at the save button, below is the code:
Private Sub cmdSaveEmployee_Click()
With rstLegalMasterlist
![EmployeeID] = Me.EmployeeID
.Update
.Close
End With
dbsLegalDB.Close
End Sub
****************
Run-time error '424'
Object required
****************
Is there anything wrong with the code ?
Regards
The recordsource for each form is "Legal Masterlist" Table and "Employee"
Table.
When I clicked a button in the "Legal Masterlist" form, it'll open up
another form called "Employee". After filling up the latter, a save button is
clicked to save the EmployeeID into the "Legal Masterlist" Table.
I have an Event Procedure for "onLoad" in the "Employee" form that declares
the database and recordset. There is also an "onClick" event procedure for
the save button in this form. Below is the code:
Private Sub Form_Load()
Dim dbsLegalDB As Database
Dim rstLegalMasterlist As Recordset
Set dbsLegalDB = OpenDatabase("LegalDB.mdb")
Set rstLegalMasterlist = dbsLegalDB.OpenRecordset("Legal Masterlist")
End Sub
*******************
Run-time error '3024'
Cannot find file 'LegalDB.mdb'
*******************
Above is the error that I encountered.
For the "onClick" event procedure at the save button, below is the code:
Private Sub cmdSaveEmployee_Click()
With rstLegalMasterlist
![EmployeeID] = Me.EmployeeID
.Update
.Close
End With
dbsLegalDB.Close
End Sub
****************
Run-time error '424'
Object required
****************
Is there anything wrong with the code ?
Regards