Update two tables from one form

ekta

Registered User.
Local time
Today, 08:59
Joined
Sep 6, 2002
Messages
160
Hi,

I have a form, frmUsers, based on tblUsers which stores info about usernames, userlevel, password. Only one Admin user has access to go to this form and add/delete users. It works fine. I have another form, frmOpp, that has a combobox that display the usernames which is based on tblCaptureLead. This table has just one field, username, which was created for the combobox. Right now when the Admin user goes and adds a user in frmUsers form it only updates tblUsers. I wanted that when a new user is added, tblCaptureLead should also be updated at the same time. Because when a user adds a new user and then go to frmOpp they don't see the new user in the combobox. Is there a way to update tblCaptureLead at the same time?

This is the code that I have behind the update button on frmUsers

Code:
Private Sub btnSubmit_Click() 'save record
On Error GoTo Err_btnSubmit_Click
'check for req'd fields
If IsNull(Me.USERID) Or Me.USERID = "" _
Or IsNull(Me.txtPassword) Or Me.txtPassword = "" Then

MsgBox "You haven't filled all the required fields to create a new user"

Else
'make sure password is 8 or more characters
If Len(Me.txtPassword) < 6 Then
MsgBox "The password should be at least 6 characters"
Else
'if so save record
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.Close
End If
End If
Exit_btnSubmit_Click:
Exit Sub

Err_btnSubmit_Click:
MsgBox Err.Description
Resume Exit_btnSubmit_Click

End Sub

Thanks,

Ekta
 

Users who are viewing this thread

Back
Top Bottom