Hi guys,
I'd like to set the controlsource of a subform's textbox. The subform is continuous. I declare an sql query on form load and wish to dynamically bind the fields from that query to the various objects on the form. Here is my code so far.
It doesn't work right now which is where I hope you guys can help me!
Many Thanks,
I'd like to set the controlsource of a subform's textbox. The subform is continuous. I declare an sql query on form load and wish to dynamically bind the fields from that query to the various objects on the form. Here is my code so far.
Code:
Dim alpha As String
Dim strSQL As String
Dim rst As DAO.Recordset
alpha = "user1"
strSQL = "SELECT tblUserReqAssignment.Requirement, tblRequirement.Acceptance_Event, tblRequirement.Verification_Status " _
& "FROM tblUserReqAssignment, tblRequirement " _
& "WHERE (((tblUserReqAssignment.Requirement)=[tblRequirement].[SR_ID]) AND " _
& "((tblUserReqAssignment.User)= '" & alpha & "'));"
Me.RecordSource = strSQL
Set rst = CurrentDb.openRecordSet(strSQL, dbOpenDynaset)
txtSR.ControlSource = rst.Fields("Requirement")
txtAcceptanceEvent.ControlSource = rst.Fields("Acceptance_Event")
txtStatus.ControlSource = rst.Fields("Verification_Status")
It doesn't work right now which is where I hope you guys can help me!
Many Thanks,