I am going to post a paraphrased version of my code (a lot of it is
if-then-else loops, so I'm just going to post the first one and erase the
rest), maybe someone can make sense of it and help me with my issues.
**************
Function OpenUserForms()
Dim strUserName As String
Dim strPassword As String
Dim FileType As String
Dim RepName As String
Dim ImportTableName As String
Dim FileToImport As String
Dim BDCC
Dim RepFile
strUserName = Forms![Login Screen]![Username]
strPassword = Forms![Login Screen]![Password]
***The following lines are a previous attempt at making this code work,
which didn't do what I wanted, but the basic structure and idea is the same,
so I'm leaving them in so you can see what I was getting at.***
If strUserName = "CG" Then
DoCmd.SetWarnings False
DoCmd.OpenQuery "PasswordVerify"
If IsPassCorrect!PassCorrect = "True" Then
DoCmd.OpenForm ("Comisha")
Else
MsgBox "The password is incorrect, please try again."
End If
***Continuing the code...***
....
If strUserName = "Admin" Then
DoCmd.OpenForm ("Admin")
For BDCC = 1 To 2
If BDCC = 1 Then
FileType = "BD"
Else
FileType = "CC"
End If
For RepFile = 1 To 7
If RepFile = 1 Then
RepName = "CG"
Else: End If
....
ImportTableName = FileType & "" & RepName
FileToImport = "c:\" & FileType & "" & RepName & ".xls"
If Len(Dir(FileToImport)) > 0 Then
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9,
ImportTableName, FileToImport, True
Else: End If
Next RepFile
Next BDCC
End If
End Function
**************
The idea behind the code is, the login screen has 2 fields, Username and
Password. If Username is a customer service rep, then the code opens their
main menu form, provided the password matches. If Username is "admin" and the
password matches, then the code imports the files from each customer service
rep (they are emailed to the supervisor at the end of the day for processing
and approval) automatically and runs the processes necessary on the imported
data. The problem is, I want to give the customer service reps the option to
change their own passwords, and in order to do that, I need to store those
values in a table, which I can't access from my code, hence my problem.