Dear all,
I'm self learning ms access Person. I am in the course of learning more about module.I understood that module is used when we think that there is repeated codes to be use. meaning to reduce the repeated codes. I have Following set of code for allotting password for opening different forms or tables or queries for security reasons. But it is painful to write same codes for different names of form, table, queries.I wonder if the following code can be written in module so that i can call for difrent forms (such as password for opening form named"frmAddrecord,frmDeleteRecord,frmEditrecord")
Therefore I request you all to help me so that i dont have to write same code for password to open different names of form.
Thank you
Sangpo
********
Private Sub cmdOK_Click()
Set db = CurrentDb
Set rs = db.OpenRecordset("UserT", DB_OPEN_DYNASET)
rs.FindFirst "password='" & CStr(textpw) & "'"
If rs.NoMatch Then
MsgBox ("Sorry, Your Password is incorrect.")
Else
DoCmd.Close acForm, "PasswordaddF", acNosave
DoCmd.OpenForm ("addRecordF")
End If
End Sub
I'm self learning ms access Person. I am in the course of learning more about module.I understood that module is used when we think that there is repeated codes to be use. meaning to reduce the repeated codes. I have Following set of code for allotting password for opening different forms or tables or queries for security reasons. But it is painful to write same codes for different names of form, table, queries.I wonder if the following code can be written in module so that i can call for difrent forms (such as password for opening form named"frmAddrecord,frmDeleteRecord,frmEditrecord")
Therefore I request you all to help me so that i dont have to write same code for password to open different names of form.
Thank you
Sangpo
********
Private Sub cmdOK_Click()
Set db = CurrentDb
Set rs = db.OpenRecordset("UserT", DB_OPEN_DYNASET)
rs.FindFirst "password='" & CStr(textpw) & "'"
If rs.NoMatch Then
MsgBox ("Sorry, Your Password is incorrect.")
Else
DoCmd.Close acForm, "PasswordaddF", acNosave
DoCmd.OpenForm ("addRecordF")
End If
End Sub