Good morning all,
I wanted to run this by you all to see if I am on the right track before I type it all up. I have a combo and depending on what is selected, I want to run a select case to
change the fields on form as well as this code below to change the record source of several CBO's. Not sure if I have all the syntax correct? Maybe a better method?
Here is the code sample, this is just a sample, Where's will all change depending on what i select!
Code:
Private Sub CboTransType_AfterUpdate()
If Not IsNull(Me.CboTransType) Then
Select Case Me.CboTransType
Case 1 ' Receive Funds
If Me.CboTransType = 1 Then
Me.CboReceivedFromID.RowSource = SELECT SystemDataID, SystemDataTypeID, SystemDataValue FROM tblSystemData WHERE SystemDataTypeID=20 ORDER BY SystemDataValue;
Me.CboFromAccount.RowSource = SELECT [qryAccountInfo].[AccountID], [qryAccountInfo].[AccountDescription], [qryAccountInfo].[AccountTypeID] FROM qryAccountInfo WHERE [AccountTypeID]=31 ORDER BY [AccountDescription];
Me.CboToAccount.RowSource = SELECT [qryAccountInfo].[AccountID], [qryAccountInfo].[AccountDescription], [qryAccountInfo].[AccountTypeID] FROM qryAccountInfo WHERE [AccountTypeID]=28 ORDER BY [AccountDescription];
Me.CboDescription.RowSource = SELECT SystemDataID, SystemDataTypeID, SystemDataValue FROM tblSystemData WHERE SystemDataTypeID=17 ORDER BY SystemDataValue;
Me.CboSelectAccount.RowSource = SELECT [qryAccountInfo].[AccountID], [qryAccountInfo].[AccountDescription], [qryAccountInfo].[AccountTypeID] FROM qryAccountInfo WHERE [AccountTypeID]=31 ORDER BY [AccountDescription];
End If
Case 2 ' Deposit Funds
If Me.CboTransType = 2 Then
Me.CboReceivedFromID.RowSource = SELECT SystemDataID, SystemDataTypeID, SystemDataValue FROM tblSystemData WHERE SystemDataTypeID=19 ORDER BY SystemDataValue;
Me.CboFromAccount.RowSource = SELECT [qryAccountInfo].[AccountID], [qryAccountInfo].[AccountDescription], [qryAccountInfo].[AccountTypeID] FROM qryAccountInfo WHERE [AccountTypeID]=28 OR [AccountTypeID]=29 ORDER BY [AccountDescription];
Me.CboToAccount.RowSource = SELECT [qryAccountInfo].[AccountID], [qryAccountInfo].[AccountDescription], [qryAccountInfo].[AccountTypeID] FROM qryAccountInfo WHERE [AccountTypeID]=28 OR [AccountTypeID]=31 ORDER BY [AccountDescription];
Me.CboDescription.RowSource = SELECT SystemDataID, SystemDataTypeID, SystemDataValue FROM tblSystemData WHERE SystemDataTypeID=18 ORDER BY SystemDataValue;
Me.CboSelectAccount.RowSource = SELECT [qryAccountInfo].[AccountID], [qryAccountInfo].[AccountDescription], [qryAccountInfo].[AccountTypeID] FROM qryAccountInfo WHERE [AccountTypeID]=29 ORDER BY [AccountDescription];
End If
Case 3 ' and so on
End Select
End Sub
Thank you all
Dave