Hey Everyone,
I just started to mess around with recordsets and I am having a bit of trouble. I have a combo box linked to a query and that works great. I have a textbox labeled txtid and the rowsource for that field is =[cmbvendor].[columns](1). The combo box is labeled cmbvendor. I then have a bunch of other text boxes. So my thought was in the after update field of the combo box have it populate the rest of the text fields based off of the txtid box. I would have done [columns] for all of it, but we need to be able to update the text fields with new information. So below is the code and I was trying to use an SQL SELECT statement with the WHERE clause. If anyone could offer some assistance that would be greatly appreciated as I am sure I am missing an easy step. Thanks!!
I just started to mess around with recordsets and I am having a bit of trouble. I have a combo box linked to a query and that works great. I have a textbox labeled txtid and the rowsource for that field is =[cmbvendor].[columns](1). The combo box is labeled cmbvendor. I then have a bunch of other text boxes. So my thought was in the after update field of the combo box have it populate the rest of the text fields based off of the txtid box. I would have done [columns] for all of it, but we need to be able to update the text fields with new information. So below is the code and I was trying to use an SQL SELECT statement with the WHERE clause. If anyone could offer some assistance that would be greatly appreciated as I am sure I am missing an easy step. Thanks!!
Code:
Option Compare Database
Option Explicit
Dim db As Database
Dim rs As Recordset
Private Sub cmbvendor_AfterUpdate()
Dim strSQL As String
Set db = CurrentDb
Set rs = strSQL
strSQL = "Select * from tblcontacts Where ID = '" & Me.txtid & "'"
Me.cmbvendorstatus = rs!vendorstatus
etc....
End Sub