I have a single form form based on a query with one table. It has a tab control with 5 pages -- no subforms. The form has an unbound combobox to look up records based on the same query.
If the DriverTypeCD is 1 (Non-Professional) a control is made visible that is required for Non-Professional. It is not visible if DriverTypeCD is 2 (Professional).
Everything worked fine until I did the following:
I added an option group (FrameShow, Default Value = 2) with two toggle buttons - one for Professional (value=2) and the other for Non-Professional (value=1).
In my query I added
I also added this code so that my combobox matches the records.
This works great to look at records.
However, when I attempt to add a record it gives me an error if I try to add a Professionial record -- it wants me to choose something from that invisible control. The same thing happens if I change a Non-Professional to a Professional.
I tried setting the recordsource without the WHERE when I click my ADD button but that didn't help.
Do I need to change my option group to use 3 radio buttons with one set to All so that I can add/change records? Or what do I need to change to get this to work?
Also, if I add a Professional record I would like the Professional toggle button to be selected after update and visa versa. I want the same thing to happen should I change the DriverTypeCD on an existing record.
I've messed with this all afternoon and can't seem to come up with a solution.
TIA,
Debbie
If the DriverTypeCD is 1 (Non-Professional) a control is made visible that is required for Non-Professional. It is not visible if DriverTypeCD is 2 (Professional).
Everything worked fine until I did the following:
I added an option group (FrameShow, Default Value = 2) with two toggle buttons - one for Professional (value=2) and the other for Non-Professional (value=1).
In my query I added
Code:
WHERE (((DRIVERS.DriverTypeCD)=[forms]![frmDrivers]![FrameShow]))
Code:
Private Sub FrameShow_AfterUpdate()
If Me.FrameShow = 2 Then
Me.Requery
Me.LookUp_combo.Requery
Me.LookUp_combo.SetFocus
ElseIf Me.FrameShow = 1 Then
Me.Requery
Me.LookUp_combo.Requery
Me.LookUp_combo.SetFocus
End If
End Sub
However, when I attempt to add a record it gives me an error if I try to add a Professionial record -- it wants me to choose something from that invisible control. The same thing happens if I change a Non-Professional to a Professional.
I tried setting the recordsource without the WHERE when I click my ADD button but that didn't help.
Do I need to change my option group to use 3 radio buttons with one set to All so that I can add/change records? Or what do I need to change to get this to work?
Also, if I add a Professional record I would like the Professional toggle button to be selected after update and visa versa. I want the same thing to happen should I change the DriverTypeCD on an existing record.
I've messed with this all afternoon and can't seem to come up with a solution.
TIA,
Debbie