Results 1 to 4 of 4
  1. #1
    libraccess's Avatar
    libraccess is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Location
    Napier New Zealand
    Posts
    129

    Value of .Value

    I have just checked a DB that had been going fine until a new user installed it with a hiccup and I went looking for the cause



    Private Sub LogIn_GotFocus()


    If Me.PUName = "1" Then
    Me.btnPrivateUser.Enabled = True

    Else

    Me.btnUserLogIn.Enabled = True

    End If

    End Sub

    PUName is Unbound Control with a row source UserID, NameExpr, strUserPass, if the User selects Private User and has the pass code the Private User Button is enabled UserID is 1 for the name PrivateUser.

    So my question is both of the following work (in fact even the "1" has been working so far ?) but the two below work on the new users machine, which of the following would be preferable


    If Me.PUName = 1 Then


    If Me.PUName.Value = 1 Then

    Thanks

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    .Value is default property for data controls. So if it is not explicitly referenced, it is assumed. It may be bad practice but I never bother typing it.

    The "1" works because the actual value in the PUName combobox is the numeric UserID.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    libraccess's Avatar
    libraccess is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Location
    Napier New Zealand
    Posts
    129
    Thanks for your reply. Still unexplained why one PC kicks this back. I first changed nothing other than removing the quotes. (it worked) but then posed the question of .Value and that worked too. Oh well I guess I'll change the Code in all FEs to = 1

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    I misread the question about quote marks. I should not have used them in my statement.

    Not sure why they would cause error with unbound combobox.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums