Nancy Lytle
nancy.lytle at auatac.com
Wed Mar 26 12:31:08 CST 2003
Well I finally got it to work for now, using DAO and the code at the end of
the message.
Now I have a user table by which I will be able to assign who sees what on
start up, and I will be able to add and move people around as necessary.
Thanks for all your help guys and girls - Now I will start working on
getting it to work using ADO (it was still giving me the missing parameters
when I gave up on it)
Nancy L
CODE:
Public Function StartDB()
Call fcnOSUserName
Dim strSQL As String
Dim db As Database
Dim strGroup As String
Dim intNameCount As Integer
Dim rstGroup As Recordset
strSQL = "SELECT tblUsers.Group FROM tblUsers "
strSQL = strSQL & "WHERE (tblUsers.UserName) = " & "'" & fcnOSUserName & "'"
MsgBox strSQL
Set db = CurrentDB
On Error Resume Next
Set rstGroup = db.OpenRecordset(strSQL)
rstGroup.MoveFirst
rstGroup.MoveLast
intNameCount = rstGroup.RecordCount
MsgBox intNameCount
'Get the value for the rstGroup Field "Group"
strGroup = rstGroup.Fields(0).Value
MsgBox strGroup
If strGroup = "A" Then
DoCmd.OpenForm "frmAdministration", acNormal, "", "", , acNormal
DoCmd.Maximize
ElseIf strGroup = "RW" Then
DoCmd.OpenForm "frmDataEntry", acNormal, "", "", , acNormal
DoCmd.Maximize
Else
DoCmd.OpenForm "z_RFil5_frmCustom", acNormal, "", "", , acNormal
DoCmd.Maximize
End If 'User name
End Function