yay a connection string joke......

Its a little backwards in the way all this code is working and there are a couple of gaps

you need to be calling/getting the userdata before you try looking at the data

Call Module1.QueryData1("SELECT UserName,Password FROM data", OutputRange)
The OutputRange here is coded like a variable.........to you have a Const OutputRange as String = "somename" somewhere in your module or is there any other code, if not this should be changed to a string, some range like "A1:B100" or the name of a namedrange


you really need to comment out all the red code and test whatst left
or send your workbook over

Private Sub CommandButton1_Click()

    Dim Username As String
    Username = TextBox9.Text
    Dim password As String
    password = TextBox10.Text
     
    If IsNull(Me.TextBox9.Text) Or Me.TextBox9.Text = "" Then
        MsgBox "You must enter your username.", vbOKOnly, "Required Data"
        Me.TextBox9.SetFocus
        Exit Sub
    End If
     
    
    If IsNull(Me.TextBox10.Text) Or Me.TextBox10.Text = "" Then
        MsgBox "You must enter your Password (case sensitive).", vbOKOnly, "Required Data"
        Me.TextBox10.SetFocus
        Exit Sub
    End If
     
    
    Dim temp As String
On Error Resume Next
temp = WorksheetFunction.VLookup(Me.TextBox9.Value, Range("UserRegister"), 1, 0)
 
If Username = temp Then
     
    Err.Clear
    temp = ""
    temp = WorksheetFunction.VLookup(Me.TextBox9.Value, Range("UserRegister"), 2, 0)
    On Error GoTo 0
    If password = temp Then
        Sheets("ADMIN").Visible = xlSheetVisible
        MsgBox "Password & Username Accepted"
        Unload Me
        Sheets("ADMIN").Select
        Range("A1").Select
    Else
        Sheets("ADMIN").Visible = xlVeryHidden
        MsgBox "Username & Password Combination Not Accepted, Workbook will close"
        Unload Me
            
        End If
    End If
     

Call Module1.QueryData1("SELECT UserName,Password FROM data", OutputRange)

End Sub