Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading textBox value

Status
Not open for further replies.

mo2783

Programmer
Nov 16, 2003
68
GB
Hi,

I have the following code which checks to see if the user log in on to the system matches the user id enter in a text box.

Code:
Public Sub CheckedUserLoggedIn()

    Dim strLoggedUser As String
    
    strLoggedUser = (Environ$("Username"))
    
   [b] strUserID = txtCDSID.text [/b]

    If strUserID = "" Then
        Exit Sub
    Else
        If UCase(strUserID) = UCase(strLoggedUser) Then
            MsgBox "Congratulations, you have permission to use the software"
        Else
            MsgBox "Sorry, But you do not have permission to use this software, please obtain permission, before trying again"
        End If
    End If
  
End Sub

I have a worksheet which has a command button when clicked should read the userid entered in a textbox on the worksheet called "txtCDSID" and then check whether the person logged in supplied the correct userid.

However when i try to read the value in text box i get the following error "Run Time Error '424' Object required"

Please help

Mo
 
Something like:
Code:
YourVal = Sheets("txtCDSID").TextBox1.Text
Hope this helps

HarleyQuinn
---------------------------------
The most overlooked advantage to owning a computer is that if they foul up there's no law against wacking them around a little. - Joe Martin

Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top