Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Verify user

Discussion in 'Information Technology' started by buzzandbeyond, Jul 28, 2006.

Tags:
  1. buzzandbeyond

    buzzandbeyond
    Expand Collapse
    Guest

    Hi,

    What I'm looking to do sounds simple in my head, but cant find out how
    to execute it.

    I dont want to use the security settings in Access, users moan about
    another password, blah blah. So what I want to do is this.

    Open the db
    automatically get the user login using fosUserName()
    Verify this exists in a table
    if yes go to main page and timestamp table
    if no, get warning error and exit.

    any assistance is most welcome.

    cheers
     
  2. Loading...


  3. Rick Brandt

    Rick Brandt
    Expand Collapse
    Guest

    buzzandbeyond wrote:
    > Hi,
    >
    > What I'm looking to do sounds simple in my head, but cant find out how
    > to execute it.
    >
    > I dont want to use the security settings in Access, users moan about
    > another password, blah blah. So what I want to do is this.
    >
    > Open the db
    > automatically get the user login using fosUserName()
    > Verify this exists in a table
    > if yes go to main page and timestamp table
    > if no, get warning error and exit.
    >
    > any assistance is most welcome.
    >
    > cheers


    What have you done so far and what are you having problems with? Have you
    gotten fosUserName() to work? Have you set up a table? All you need after
    that is a simple DLookup() call to test if the current user exists in the
    table...

    If IsNull(DLookup("UserName", "TableName", "UserName = '" & fosUserName() &
    "'")) = True Then
    MsgBox "your warning"
    DoCmd.Quit
    Else...


    --
    Rick Brandt, Microsoft Access MVP
    Email (as appropriate) to...
    RBrandt at Hunter dot com
     
  4. buzzandbeyond

    buzzandbeyond
    Expand Collapse
    Guest

    Rick Brandt wrote:
    > buzzandbeyond wrote:
    > > Hi,
    > >
    > > What I'm looking to do sounds simple in my head, but cant find out how
    > > to execute it.
    > >
    > > I dont want to use the security settings in Access, users moan about
    > > another password, blah blah. So what I want to do is this.
    > >
    > > Open the db
    > > automatically get the user login using fosUserName()
    > > Verify this exists in a table
    > > if yes go to main page and timestamp table
    > > if no, get warning error and exit.
    > >
    > > any assistance is most welcome.
    > >
    > > cheers

    >
    > What have you done so far and what are you having problems with? Have you
    > gotten fosUserName() to work? Have you set up a table? All you need after
    > that is a simple DLookup() call to test if the current user exists in the
    > table...
    >
    > If IsNull(DLookup("UserName", "TableName", "UserName = '" & fosUserName() &
    > "'")) = True Then
    > MsgBox "your warning"
    > DoCmd.Quit
    > Else...
    >
    >
    > --
    > Rick Brandt, Microsoft Access MVP
    > Email (as appropriate) to...
    > RBrandt at Hunter dot com


    Hi Rick

    At present anyone can access the db and run the reports, but not view /
    edit the info. I am trying to stop everyone running the reports.

    I've got the fosUserName() to work in the relevant queries. I have all
    my tables setup including one titled tblOwner that contains the userid
    (the field I need to check against).

    I'm not sure where the best place to add the above script would be.

    Does this make sense?

    Dave
     
  5. Rick Brandt

    Rick Brandt
    Expand Collapse
    Guest

    buzzandbeyond wrote:
    > At present anyone can access the db and run the reports, but not view
    > / edit the info. I am trying to stop everyone running the reports.
    >
    > I've got the fosUserName() to work in the relevant queries. I have
    > all my tables setup including one titled tblOwner that contains the
    > userid (the field I need to check against).
    >
    > I'm not sure where the best place to add the above script would be.
    >
    > Does this make sense?


    You would need to run it in a code routine that executes when the app is
    first opened. This could be a VBA function executed with the AutoExec macro
    or it could be code in the Open or Load event of a form you have designated
    to open in Startup properties.

    --
    Rick Brandt, Microsoft Access MVP
    Email (as appropriate) to...
    RBrandt at Hunter dot com
     
  6. Pieter Wijnen

    Pieter Wijnen
    Expand Collapse
    Guest

    You could also add security with a blank /same password for all users & use
    a link to open the db
    %programFiles%\Microsoft Office\Offfice\msaccess.exe <path to the db>
    /wrkGrp<path to system db> /UID%USERNAME% /pwdsecret
    this would require the username in the db to be the same as the windows
    logon id (reccommended anyway)

    Pieter

    "Rick Brandt" <rickbrandt2@hotmail.com> wrote in message
    news:9YPug.49882$VE1.32362@newssvr14.news.prodigy.com...
    > buzzandbeyond wrote:
    >> At present anyone can access the db and run the reports, but not view
    >> / edit the info. I am trying to stop everyone running the reports.
    >>
    >> I've got the fosUserName() to work in the relevant queries. I have
    >> all my tables setup including one titled tblOwner that contains the
    >> userid (the field I need to check against).
    >>
    >> I'm not sure where the best place to add the above script would be.
    >>
    >> Does this make sense?

    >
    > You would need to run it in a code routine that executes when the app is
    > first opened. This could be a VBA function executed with the AutoExec
    > macro or it could be code in the Open or Load event of a form you have
    > designated to open in Startup properties.
    >
    > --
    > Rick Brandt, Microsoft Access MVP
    > Email (as appropriate) to...
    > RBrandt at Hunter dot com
    >
     
  7. Pieter Wijnen

    Pieter Wijnen
    Expand Collapse
    Guest

    You could also add security with a blank /same password for all users & use
    a link to open the db
    %programFiles%\Microsoft Office\Offfice\msaccess.exe <path to the db>
    /wrkGrp<path to system db> /UID%USERNAME% /pwdsecret
    this would require the username in the db to be the same as the windows
    logon id (reccommended anyway)

    Pieter

    "Rick Brandt" <rickbrandt2@hotmail.com> wrote in message
    news:9YPug.49882$VE1.32362@newssvr14.news.prodigy.com...
    > buzzandbeyond wrote:
    >> At present anyone can access the db and run the reports, but not view
    >> / edit the info. I am trying to stop everyone running the reports.
    >>
    >> I've got the fosUserName() to work in the relevant queries. I have
    >> all my tables setup including one titled tblOwner that contains the
    >> userid (the field I need to check against).
    >>
    >> I'm not sure where the best place to add the above script would be.
    >>
    >> Does this make sense?

    >
    > You would need to run it in a code routine that executes when the app is
    > first opened. This could be a VBA function executed with the AutoExec
    > macro or it could be code in the Open or Load event of a form you have
    > designated to open in Startup properties.
    >
    > --
    > Rick Brandt, Microsoft Access MVP
    > Email (as appropriate) to...
    > RBrandt at Hunter dot com
    >




    --
    ----------------------------------------
    I am using the free version of SPAMfighter for private users.
    It has removed 4231 spam emails to date.
    Paying users do not have this message in their emails.
    Get the free SPAMfighter here: http://www.spamfighter.com/len
     
  8. buzzandbeyond

    buzzandbeyond
    Expand Collapse
    Guest

    Re: Verify user - VBA issue

    Hi

    I've got the following code:

    ********************
    Private Sub Form_Open(Cancel As Integer)
    If DLookup("[OwnerLogin]", "tblOwner", "[OwnerLogin] <> ' &
    fOSUserName() & '") = True Then
    MsgBox " Sorry " & fOSUserName() & ", You do not have access to
    this database", vbExclamation, " Access Denied "
    Else
    MsgBox " Welcome, " & fOSUserName()
    End If
    End Sub
    ********************
    but I cant get it to check the fOSUserName against the OwnerLogin in
    the tblOwner.

    I know this as I have removed my OwnerLogin and get the same message.

    cheers
     
  9. Joan Wild

    Joan Wild
    Expand Collapse
    Guest

    Re: Verify user - VBA issue

    If DLookup("[OwnerLogin]", "tblOwner") <> fOSUserName() Then
    or
    If DLookup("[OwnerLogin]", "tblOwner") <> chr(34) & fOSUserName() & chr(34)
    Then

    (not sure if the chr(34) are needed or not)



    --
    Joan Wild
    Microsoft Access MVP

    buzzandbeyond wrote:
    > Hi
    >
    > I've got the following code:
    >
    > ********************
    > Private Sub Form_Open(Cancel As Integer)
    > MsgBox " Sorry " & fOSUserName() & ", You do not have access to
    > this database", vbExclamation, " Access Denied "
    > Else
    > MsgBox " Welcome, " & fOSUserName()
    > End If
    > End Sub
    > ********************
    > but I cant get it to check the fOSUserName against the OwnerLogin in
    > the tblOwner.
    >
    > I know this as I have removed my OwnerLogin and get the same message.
    >
    > cheers
     
  10. Douglas J. Steele

    Douglas J. Steele
    Expand Collapse
    Guest

    Re: Verify user - VBA issue

    Does tblOwner contain a single row, or multiple rows?

    If it's single row only, Joan's solution should work.

    If it's multiple rows, you need to replace

    If DLookup("[OwnerLogin]", "tblOwner", "[OwnerLogin] <> ' &
    fOSUserName() & '") = True Then

    with

    If DLookup("[OwnerLogin]", "tblOwner", "[OwnerLogin] <> '" &
    fOSUserName() & "'") = True Then

    Exagerated for clarity, that's

    If DLookup("[OwnerLogin]", "tblOwner", "[OwnerLogin] <> ' " &
    fOSUserName() & " ' ") = True Then


    --
    Doug Steele, Microsoft Access MVP
    http://I.Am/DougSteele
    (no private e-mails, please)


    "buzzandbeyond" <david.nixon@ubs.com> wrote in message
    news:1153322492.284181.134600@i42g2000cwa.googlegroups.com...
    > Hi
    >
    > I've got the following code:
    >
    > ********************
    > Private Sub Form_Open(Cancel As Integer)
    > If DLookup("[OwnerLogin]", "tblOwner", "[OwnerLogin] <> ' &
    > fOSUserName() & '") = True Then
    > MsgBox " Sorry " & fOSUserName() & ", You do not have access to
    > this database", vbExclamation, " Access Denied "
    > Else
    > MsgBox " Welcome, " & fOSUserName()
    > End If
    > End Sub
    > ********************
    > but I cant get it to check the fOSUserName against the OwnerLogin in
    > the tblOwner.
    >
    > I know this as I have removed my OwnerLogin and get the same message.
    >
    > cheers
    >
     
  11. buzzandbeyond

    buzzandbeyond
    Expand Collapse
    Guest

    Re: Verify user - VBA issue

    The tblOwner contains several different rows, these are the people I
    want to access the system.

    I've used Doug's example below, however it still does not pick up the
    difference if the user is / isnt in the table.

    What have i done wrong?

    Douglas J. Steele wrote:
    > Does tblOwner contain a single row, or multiple rows?
    >
    > If it's single row only, Joan's solution should work.
    >
    > If it's multiple rows, you need to replace
    >
    > If DLookup("[OwnerLogin]", "tblOwner", "[OwnerLogin] <> ' &
    > fOSUserName() & '") = True Then
    >
    > with
    >
    > If DLookup("[OwnerLogin]", "tblOwner", "[OwnerLogin] <> '" &
    > fOSUserName() & "'") = True Then
    >
    > Exagerated for clarity, that's
    >
    > If DLookup("[OwnerLogin]", "tblOwner", "[OwnerLogin] <> ' " &
    > fOSUserName() & " ' ") = True Then
    >
    >
    > --
    > Doug Steele, Microsoft Access MVP
    > http://I.Am/DougSteele
    > (no private e-mails, please)
    >
    >
    > "buzzandbeyond" <david.nixon@ubs.com> wrote in message
    > news:1153322492.284181.134600@i42g2000cwa.googlegroups.com...
    > > Hi
    > >
    > > I've got the following code:
    > >
    > > ********************
    > > Private Sub Form_Open(Cancel As Integer)
    > > If DLookup("[OwnerLogin]", "tblOwner", "[OwnerLogin] <> ' &
    > > fOSUserName() & '") = True Then
    > > MsgBox " Sorry " & fOSUserName() & ", You do not have access to
    > > this database", vbExclamation, " Access Denied "
    > > Else
    > > MsgBox " Welcome, " & fOSUserName()
    > > End If
    > > End Sub
    > > ********************
    > > but I cant get it to check the fOSUserName against the OwnerLogin in
    > > the tblOwner.
    > >
    > > I know this as I have removed my OwnerLogin and get the same message.
    > >
    > > cheers
    > >
     
  12. Douglas J. Steele

    Douglas J. Steele
    Expand Collapse
    Guest

    Re: Verify user - VBA issue

    Sorry, I wasn't thinking.

    If IsNull(DLookup("[OwnerLogin]", "tblOwner", "[OwnerLogin] <> '" &
    fOSUserName() & "'")) = False Then


    --
    Doug Steele, Microsoft Access MVP
    http://I.Am/DougSteele
    (no private e-mails, please)


    "buzzandbeyond" <david.nixon@ubs.com> wrote in message
    news:1153492767.043184.228410@m79g2000cwm.googlegroups.com...
    > The tblOwner contains several different rows, these are the people I
    > want to access the system.
    >
    > I've used Doug's example below, however it still does not pick up the
    > difference if the user is / isnt in the table.
    >
    > What have i done wrong?
    >
    > Douglas J. Steele wrote:
    >> Does tblOwner contain a single row, or multiple rows?
    >>
    >> If it's single row only, Joan's solution should work.
    >>
    >> If it's multiple rows, you need to replace
    >>
    >> If DLookup("[OwnerLogin]", "tblOwner", "[OwnerLogin] <> ' &
    >> fOSUserName() & '") = True Then
    >>
    >> with
    >>
    >> If DLookup("[OwnerLogin]", "tblOwner", "[OwnerLogin] <> '" &
    >> fOSUserName() & "'") = True Then
    >>
    >> Exagerated for clarity, that's
    >>
    >> If DLookup("[OwnerLogin]", "tblOwner", "[OwnerLogin] <> ' " &
    >> fOSUserName() & " ' ") = True Then
    >>
    >>
    >> --
    >> Doug Steele, Microsoft Access MVP
    >> http://I.Am/DougSteele
    >> (no private e-mails, please)
    >>
    >>
    >> "buzzandbeyond" <david.nixon@ubs.com> wrote in message
    >> news:1153322492.284181.134600@i42g2000cwa.googlegroups.com...
    >> > Hi
    >> >
    >> > I've got the following code:
    >> >
    >> > ********************
    >> > Private Sub Form_Open(Cancel As Integer)
    >> > If DLookup("[OwnerLogin]", "tblOwner", "[OwnerLogin] <> ' &
    >> > fOSUserName() & '") = True Then
    >> > MsgBox " Sorry " & fOSUserName() & ", You do not have access to
    >> > this database", vbExclamation, " Access Denied "
    >> > Else
    >> > MsgBox " Welcome, " & fOSUserName()
    >> > End If
    >> > End Sub
    >> > ********************
    >> > but I cant get it to check the fOSUserName against the OwnerLogin in
    >> > the tblOwner.
    >> >
    >> > I know this as I have removed my OwnerLogin and get the same message.
    >> >
    >> > cheers
    >> >

    >
     
  13. buzzandbeyond

    buzzandbeyond
    Expand Collapse
    Guest

    Re: Verify user - VBA issue

    DOUG,

    I BLODDY LOVE YOU, MAN.

    cheers
    Dave


    Douglas J. Steele wrote:
    > Sorry, I wasn't thinking.
    >
    > If IsNull(DLookup("[OwnerLogin]", "tblOwner", "[OwnerLogin] <> '" &
    > fOSUserName() & "'")) = False Then
    >
    >
    > --
    > Doug Steele, Microsoft Access MVP
    > http://I.Am/DougSteele
    > (no private e-mails, please)
    >
    >
    > "buzzandbeyond" <david.nixon@ubs.com> wrote in message
    > news:1153492767.043184.228410@m79g2000cwm.googlegroups.com...
    > > The tblOwner contains several different rows, these are the people I
    > > want to access the system.
    > >
    > > I've used Doug's example below, however it still does not pick up the
    > > difference if the user is / isnt in the table.
    > >
    > > What have i done wrong?
    > >
    > > Douglas J. Steele wrote:
    > >> Does tblOwner contain a single row, or multiple rows?
    > >>
    > >> If it's single row only, Joan's solution should work.
    > >>
    > >> If it's multiple rows, you need to replace
    > >>
    > >> If DLookup("[OwnerLogin]", "tblOwner", "[OwnerLogin] <> ' &
    > >> fOSUserName() & '") = True Then
    > >>
    > >> with
    > >>
    > >> If DLookup("[OwnerLogin]", "tblOwner", "[OwnerLogin] <> '" &
    > >> fOSUserName() & "'") = True Then
    > >>
    > >> Exagerated for clarity, that's
    > >>
    > >> If DLookup("[OwnerLogin]", "tblOwner", "[OwnerLogin] <> ' " &
    > >> fOSUserName() & " ' ") = True Then
    > >>
    > >>
    > >> --
    > >> Doug Steele, Microsoft Access MVP
    > >> http://I.Am/DougSteele
    > >> (no private e-mails, please)
    > >>
    > >>
    > >> "buzzandbeyond" <david.nixon@ubs.com> wrote in message
    > >> news:1153322492.284181.134600@i42g2000cwa.googlegroups.com...
    > >> > Hi
    > >> >
    > >> > I've got the following code:
    > >> >
    > >> > ********************
    > >> > Private Sub Form_Open(Cancel As Integer)
    > >> > If DLookup("[OwnerLogin]", "tblOwner", "[OwnerLogin] <> ' &
    > >> > fOSUserName() & '") = True Then
    > >> > MsgBox " Sorry " & fOSUserName() & ", You do not have access to
    > >> > this database", vbExclamation, " Access Denied "
    > >> > Else
    > >> > MsgBox " Welcome, " & fOSUserName()
    > >> > End If
    > >> > End Sub
    > >> > ********************
    > >> > but I cant get it to check the fOSUserName against the OwnerLogin in
    > >> > the tblOwner.
    > >> >
    > >> > I know this as I have removed my OwnerLogin and get the same message.
    > >> >
    > >> > cheers
    > >> >

    > >
     

Share This Page