3239
Technical User
- May 14, 2003
- 64
Hello,
I am trying to create a function that sets the record source of a form by passing a query to the function. I am a beginner in writing functions and don't how to accomplish this task.
Here is a snippet of the code that I am trying to turn into a function.
Thanks.
I am trying to create a function that sets the record source of a form by passing a query to the function. I am a beginner in writing functions and don't how to accomplish this task.
Here is a snippet of the code that I am trying to turn into a function.
Thanks.
Code:
Public Sub GetRequisitions()
Dim frm As Form
Set frm = Forms!POCreator
Select Case frm.cboDepartment.Value
Case "ADMIN"
frm.RecordSource = "ADMIN_REQ"
frm.xRequisition.RowSource = "ADMIN_REQ"
frm.xReqItems.RowSource = "ADMIN_REQ_DETAILS"
frm.xRequisition.Enabled = False
frm.POID.Enabled = True
frm.POID.SetFocus
Case "AHYD"
frm.RecordSource = "AHYD_REQ"
frm.xRequisition.RowSource = "AHYD_REQ"
frm.xReqItems.RowSource = "AHYD_REQ_DETAILS"
frm.xRequisition.Enabled = False
frm.POID.Enabled = True
frm.POID.SetFocus
Case "BCW"
frm.RecordSource = "BCW_REQ"
frm.xRequisition.RowSource = "BCW_REQ"
frm.xReqItems.RowSource = "BCW_REQ_DETAILS"
frm.xRequisition.Enabled = False
frm.POID.Enabled = True
frm.POID.SetFocus
Case "CENTRAL SUPPLY"
frm.RecordSource = "CENTRALSUPPLY_REQ"
frm.xRequisition.RowSource = "CENTRALSUPPLY_REQ"
frm.xReqItems.RowSource = "CENTRALSUPPLY_REQ_DETAILS"
frm.xRequisition.Enabled = False
frm.POID.Enabled = True
frm.POID.SetFocus
End Select
End Sub