Results 1 to 7 of 7
  1. #1
    Join Date
    Dec 2003
    Location
    Dallas, TX
    Posts
    1,004

    Talking Unanswered: Help with Log On password form code

    Good afternoon everyone,

    I am having a problem with a database of mine. Actually, it worked fine in A97 and later in A2K, now however I can't get it to work in A2K3. Used to I could put in my UserName and Password and get into the database. Now as soon as I click to enter the database I get an error.

    Code:
    'Run time error '91':
    Object variable or With object variable not set
    Just what does this mean? Oh, I did Convert and did Compact/Repair already. So I guess it's more than that. The line below is highlighted in Yellow:


    Code:
     Me![Option1].SetFocus
        For intOption = 2 To conNumButtons
            Me("Option" & intOption).Visible = False
            Me("OptionLabel" & intOption).Visible = False
        Next intOption
        
        ' Open the table of Switchboard Items, and find
        ' the first item for this Switchboard Page.
        'Set con = CurrentProject.Connection
        con = CurrentDb.TableDefs("Switchboard Items").Connect
        stSql = "SELECT * FROM [Switchboard Items]"
        stSql = stSql & " WHERE [ItemNumber] > 0 AND [SwitchboardID]=" & Me![SwitchboardID]
        stSql = stSql & " ORDER BY [ItemNumber];"
        Set rs = CreateObject("ADODB.Recordset")
        rs.Open stSql, con, 1   ' 1 = adOpenKeyset
    If you could help me out it will be greatly appreciated.
    Have a nice one,
    BUD

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    What's different between the line that errors and the one that's commented out above it... I'll let you set a while and think about it...
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  3. #3
    Join Date
    Dec 2003
    Location
    Dallas, TX
    Posts
    1,004

    Talking

    Quote Originally Posted by Teddy
    What's different between the line that errors and the one that's commented out above it... I'll let you set a while and think about it...
    Hiya Teddy,
    Though I found that code and used it, and note really a guru at code I am thinking (guessing) that the line above " 'Set con = should not be commented out? Hard to tell what should be since it worked flawlessly in A2K. IF I guessed it right, please explain how it got commented out and why? I've had a few problems with databases not converting over properly to A2K3 from A97 and A2K.
    So let me know if I win the cigar or not.

    back soon,
    BUD

  4. #4
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Try lobbing a "set" in front of the line that's bombing...

    For reference, the commented out line looks a little better. The way you've got going on there looks a little funky.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  5. #5
    Join Date
    Dec 2003
    Location
    Dallas, TX
    Posts
    1,004
    Quote Originally Posted by Teddy
    Try lobbing a "set" in front of the line that's bombing...

    For reference, the commented out line looks a little better. The way you've got going on there looks a little funky.
    Hey Teddy, you mean place the word "set" in front of the line that starts:

    Set con = CurrentDb.TableDefs("Switchboard Items").Connect

    Remember I am not all that good with it, especially since I didn't write it but just used someone elses. Anyhow I cant test until I get back to work.

    talk later
    BUD

  6. #6
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926

    Login/Password

    Here's a nifty way to find the user's login. User's don't like to enter passwords (I wouldn't like to enter a password everytime) so I use the approach of putting the user's login name into a table and if the user's login name is in that table, that user has access to whatever they are trying to do. I've posted this many times on this board and it works very well. Give it a try and I think you may find it useful. You could even add a table which allows certain user loginIDs to use the program and if the user isn't in that table, the program automatically quits. But seriously, put yourself in the user's shoes, would you want to enter a login name and password everytime? Wouldn't it be easier if the program just got the Windows login name and the program gave you certain rights to certain parts of the program based on if your loginID was in a specific admin type table or not? Give the example a try and expand on it. I think you'll find a lot happier customers.
    Attached Files Attached Files
    Last edited by pkstormy; 12-19-06 at 15:29.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  7. #7
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926

    Logins/Passwords

    I may have uploaded a different version of the loginID/Password version I was working on so here's another copy of the same type of code.
    Attached Files Attached Files
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •