how to pass value between two forms using VBA in Access 2003?
Posted on 2006-06-08
Hi, this is what i am trying to do.
I have a combo box in form1 and a button. User select a value from the combo box and click then click the button. it opens another form which does quey using the value that user selected from the combo box.
this is the query code in the form2. i want x = form1's combo box value. please help.
Dim x As String
x = form1's combo box value
Set db = CurrentDb
strSQL = "SELECT id, name FROM T_test where name = x"
Set rst = db.OpenRecordset(strSQL)
Set Me.Recordset = rst
Me.txtName.ControlSource = "Name"
Me.id.ControlSource = "id"