Hi new to programming VBA in Access 2003.
I have a form which has two comboboxes.
The first combobox uses the folowing rowsource.
SELECT Outputs_Classif ication.Output_ id, Outputs_Classif ication.OutputC lass FROM Outputs_Classif ication;
The second combobox uses the afterupdate VBA code to select the rowsource of the second combbobox as below.
Private Sub Form_Current()
Me!SB_combo.Req uery
End Sub
Private Sub ServiceBenefit_ combo_AfterUpda te()
Dim Physical As Integer, Output As Integer
Me.SB_combo = 0
Me.SB_combo.Req uery
Output = ServiceBenefit_ combo.Value
Forms![Service_Benefit _Classification]!SB_combo.RowSo urceType = "Table/Query"
Forms![Service_Benefit _Classification]!SB_combo.RowSo urce = "SELECT Service_Benefit _Categories.SB_ id , Service_Benefit _Categories.Ser vice_Benefits FROM Service_Benefit _Categories WHERE SBid = " & CStr(Output) & " ORDER BY Service_Benefit _Categories.Ser vice_Benefits;"
Forms![Service_Benefit _Classification]!SB_combo.Colum nCount = "2"
Forms![Service_Benefit _Classification]!SB_combo.Colum nWidths = "0"
Forms![Service_Benefit _Classification]!SB_combo.ListR ows = 27
End Sub
This works fine until I place the form as a subform in an other table.
Both forms are bound to the same table.
However the code does not work in the subform and I have read some threads and placed the following in the MainForm OnLoad event, however with out success.
Forms![Outputs Form]![Service_Benefit _Classification].Form![ServiceBenefit_ combo].Requery
Forms![Outputs Form]![Service_Benefit _Classification].Form![SB_combo].Requery
Would be grateful for any advice?
I have a form which has two comboboxes.
The first combobox uses the folowing rowsource.
SELECT Outputs_Classif ication.Output_ id, Outputs_Classif ication.OutputC lass FROM Outputs_Classif ication;
The second combobox uses the afterupdate VBA code to select the rowsource of the second combbobox as below.
Private Sub Form_Current()
Me!SB_combo.Req uery
End Sub
Private Sub ServiceBenefit_ combo_AfterUpda te()
Dim Physical As Integer, Output As Integer
Me.SB_combo = 0
Me.SB_combo.Req uery
Output = ServiceBenefit_ combo.Value
Forms![Service_Benefit _Classification]!SB_combo.RowSo urceType = "Table/Query"
Forms![Service_Benefit _Classification]!SB_combo.RowSo urce = "SELECT Service_Benefit _Categories.SB_ id , Service_Benefit _Categories.Ser vice_Benefits FROM Service_Benefit _Categories WHERE SBid = " & CStr(Output) & " ORDER BY Service_Benefit _Categories.Ser vice_Benefits;"
Forms![Service_Benefit _Classification]!SB_combo.Colum nCount = "2"
Forms![Service_Benefit _Classification]!SB_combo.Colum nWidths = "0"
Forms![Service_Benefit _Classification]!SB_combo.ListR ows = 27
End Sub
This works fine until I place the form as a subform in an other table.
Both forms are bound to the same table.
However the code does not work in the subform and I have read some threads and placed the following in the MainForm OnLoad event, however with out success.
Forms![Outputs Form]![Service_Benefit _Classification].Form![ServiceBenefit_ combo].Requery
Forms![Outputs Form]![Service_Benefit _Classification].Form![SB_combo].Requery
Would be grateful for any advice?