navigator703
MIS
Good Morning-
I am new to VB and VB Forms. I am still in the learning phase. I have searched these forums, connectionstrings.com, even ask.com. I'm getting a little confused with all the information. I will make this quick and simple:
1) I have one access table
2) I am using a VB form to return my name, if my name is
entered into a text box correctly
3) Once the 'OK' button is pressed, then the search and
return will begin
4) I just want to return my name after the search into
another text box on another form
If you have any suggestions, please let me know. Thanks. Here is the code I have so far:
I am new to VB and VB Forms. I am still in the learning phase. I have searched these forums, connectionstrings.com, even ask.com. I'm getting a little confused with all the information. I will make this quick and simple:
1) I have one access table
2) I am using a VB form to return my name, if my name is
entered into a text box correctly
3) Once the 'OK' button is pressed, then the search and
return will begin
4) I just want to return my name after the search into
another text box on another form
If you have any suggestions, please let me know. Thanks. Here is the code I have so far:
Code:
Private Sub Command1_Click()
Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim connStr As String
Dim connStr2 As String
connStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\db1.mdb;"
Set conn = New ADODB.Connection
Set rs = New ADODB.Recordset
conn.Open connStr
conn.CommandTimeout = 0
With rs
.CursorLocation = adUseClient
.LockType = adLockReadOnly
.CursorType = adOpenStatic
.Source = SQLString
Set .ActiveConnection = Nothing
End With
If Text1.Text = "Joe Gibbs" Then
sSQL = "SELECT Table1.Name FROM Table1"
sSQL = sSQL & " where " & sWhereclause
sWhereclause = " Table1.Name = ' " & connStr
connStr2 = sSQL
Results.Text2.Text = connStr2
Results.Show
Unload Me
Else
Error.Show
Search.Hide
End If
Set ReturnRecordset = rs
ExitHandler:
Set rs = Nothing
Exit Sub
End Sub