Stu Dapples
Active Member
- Joined
- Jan 12, 2009
- Messages
- 252
Hello again!
I have a table in which there is a subform. I would like the subform to return the records relating to a part number entered in the main form.
I have put the SELECT query together and as far as I can see, it is running OK.
If I start the query builder in Access and choose SQLview, paste the code in and hit run, it returns a neat looking table with the relevant data in. However, if I run the same syntax in VBA, it just runs through and does not populate the subform. I am guessing I am missing a command but I am lost as to what it is I need to do....
<Code>
Private Sub Child42_Enter()
Dim strsql As String, rst As New ADODB.Recordset
strsql = "SELECT ProgStep, ProgNo, Robot, IntercoatDry FROM Programs WHERE PartNo = '" & Me.PartNo.Value & "'"
Debug.Print strsql
rst.Open strsql, CurrentProject.Connection, adOpenForwardOnly, adLockReadOnly
End Sub
</code>
This appears to get teh recordset but not output them....
HELP!!
Stu
I have a table in which there is a subform. I would like the subform to return the records relating to a part number entered in the main form.
I have put the SELECT query together and as far as I can see, it is running OK.
If I start the query builder in Access and choose SQLview, paste the code in and hit run, it returns a neat looking table with the relevant data in. However, if I run the same syntax in VBA, it just runs through and does not populate the subform. I am guessing I am missing a command but I am lost as to what it is I need to do....
<Code>
Private Sub Child42_Enter()
Dim strsql As String, rst As New ADODB.Recordset
strsql = "SELECT ProgStep, ProgNo, Robot, IntercoatDry FROM Programs WHERE PartNo = '" & Me.PartNo.Value & "'"
Debug.Print strsql
rst.Open strsql, CurrentProject.Connection, adOpenForwardOnly, adLockReadOnly
End Sub
</code>
This appears to get teh recordset but not output them....
HELP!!
Stu