GoodLife22
Registered User.
- Local time
- Today, 17:23
- Joined
- Mar 4, 2010
- Messages
- 86
I am opening a form with the following code:
The form is bound to a different query so I am running this recordset to use in one other section of the form. My sSQL query runs perfect currently and my message boxes show the correct values.
Now I want to create 4 unbound fields on my form and show all of the information from the message boxes.
I created four unbound fields and named them (txtName, txtPHONE, txtFAX, txtEmail) however when I open the form none of the data is in these fields.
So should I be doing something other than an unbound field? Is it the way I am naming my unbound fields? Since I have the value of rs!Name, rs!PHONE, rs!Fax, & rs!Email (I know the info is there, I can see it in my message boxes) how do I get them onto my form?
Thanks.
Code:
Public Sub getEmployee(sEmployee As String)
Dim db As dao.Database
Dim sSQL As String
Dim sRS As dao.Recordset
sSQL = "SELECT * FROM tbl__STAFF WHERE INITIALS='" & sEmployee & "'"
Set db = CurrentDb()
Set rs = db.OpenRecordset(sSQL)
MsgBox ("Name: " & rs!Name)
MsgBox ("Phone: " & rs!PHONE)
MsgBox ("Fax: " & rs!FAX)
MsgBox ("Email: " & rs!EMAIL)
'txtName.Value = rs!Name
'Me.txtName = rs!Name
'txtPhone.Text = rs!PHONE
'rs!FAX = Me!txtFax.Text
'rs!Email = Me!txtEmail.Text
rs.Close
Set rs = Nothing
The form is bound to a different query so I am running this recordset to use in one other section of the form. My sSQL query runs perfect currently and my message boxes show the correct values.
Now I want to create 4 unbound fields on my form and show all of the information from the message boxes.
I created four unbound fields and named them (txtName, txtPHONE, txtFAX, txtEmail) however when I open the form none of the data is in these fields.
So should I be doing something other than an unbound field? Is it the way I am naming my unbound fields? Since I have the value of rs!Name, rs!PHONE, rs!Fax, & rs!Email (I know the info is there, I can see it in my message boxes) how do I get them onto my form?
Thanks.