form to table

riddicule123

Registered User.
Local time
Today, 15:16
Joined
May 27, 2015
Messages
29
hi,

is there a way for you to pick a selection from a combo box that will auto populate many tables with the same detail depending on which form you open next????.

ok so let me elaborate, i have a central database that i use for many things, mailing, complaints, faults etc. this is a multi user database which has at least 32 people using it. each table e.g. mailing, complaints, faults has its own form and table which are bound to each other. now previously we had so on each form the user would select their name and that would auto populate into each table. (usernames have their own table). now however it seems we would like a login form. so i made a login form but i want to stop people from selecting the wrong names. so i though that if there is a way to select the username from the login form then when you choose a form to open the username is already auto populated into the table related to the form you opened.
 
That seems like a lot of work to have separate tables for each person, when you should just have 1 table and a username field.

When the form opens, you can capture the user name with
user = Environ("Username")

no login needed.
 
ah see thats where it get difficult.the reason i have a login screen i because everyone is a admin on security and i cant work it. the forms are used to capture data and extract at the end of each night for instance all mail from the mailing form/table gets posted that night. we use this central database in order to log many different bits of data with ease. i currently have 8 forms bound to 8 tables like this. mailing form/ mailing table , complaints form/ complaints table login form/ user table. what we need is for people to use the login form then their username automatically fills the username field in the tables depending on which form the user is filling in.
 
Thats fine. Many forms to work in but all the data goes to the same table.
I still dont know why EACH user needs their own table. Seems a bad design.
But if its working then use it.
Now you have the user id, you can use network authentication.

Code:
If WindowsLogin(sUser, sPass, sDom) Then
   mbSafe = True
   DoCmd.OpenForm "frmMainMenu"
   DoCmd.OpenForm "frmLogin"
   DoCmd.Close
Else
   MsgBox "LOGIN INCORRECT", vbCritical, "Bad userid or password"
End If


Public Function WindowsLogin(ByVal strUserName As String, ByVal strpassword As String, ByVal strDomain As String) As Boolean
        'Authenticates user and password entered with Active Directory.

        On Error GoTo IncorrectPassword
        
        Dim oADsObject, oADsNamespace As Object
        Dim strADsPath As String
        
        strADsPath = "WinNT://" & strDomain
        Set oADsObject = GetObject(strADsPath)
        Set oADsNamespace = GetObject("WinNT:")
        Set oADsObject = oADsNamespace.OpenDSObject(strADsPath, strDomain & "\" & strUserName, strpassword, 0)
        
        WindowsLogin = True    'ACCESS GRANTED
        
ExitSub:
        Exit Function
        
IncorrectPassword:
        WindowsLogin = False   'ACCESS DENIED
        Resume ExitSub
End Function
 

Users who are viewing this thread

Back
Top Bottom