P
Paul Scott
I have a form with a subform. I have a field called
Facility on the form frmBedCleaningEntry and a
RequestedBy on the subform.
If the facility is Hazelwood then the focus is set to
ExtNo Field. If it's not Hazelwood then NA is placed in
the ExtNo field, a phone # is placed in the PhoneNo field
and the focus is set to the CleaningDescrip field.
I have no problem getting the code to work on a single
form but have tried everything but can't get the code to
work with the subform.
Could someone look over the enclosed code and see if they
can see why the code isn't working?
I've always had problems in the past getting the focus
from the form to the subform. What's the secret getting
the focus to work from a form to a subform?
Thanks for the help,
Paul
Private Sub RequestedBy_AfterUpdate()
If [frmBedCleaningEntry]![Facility] = "Hazelwood"
Then
PhoneNo = "NA"
ExtNo.SetFocus
End If
If [frmBedCleaningEntry]![Facility] = "Meadows" Then
PhoneNo = "555-1234"
ExtNo = "NA"
CleaningDescrip.SetFocus
End If
If [frmBedCleaningEntry]![Facility] = "Windsong" Then
PhoneNo = "555-2345"
ExtNo = "NA"
CleaningDescrip.SetFocus
End If
If [frmBedCleaningEntry]![Facility] = "DelMaria" Then
PhoneNo = "555-3456"
ExtNo = "NA"
CleaningDescrip.SetFocus
End If
End Sub
Facility on the form frmBedCleaningEntry and a
RequestedBy on the subform.
If the facility is Hazelwood then the focus is set to
ExtNo Field. If it's not Hazelwood then NA is placed in
the ExtNo field, a phone # is placed in the PhoneNo field
and the focus is set to the CleaningDescrip field.
I have no problem getting the code to work on a single
form but have tried everything but can't get the code to
work with the subform.
Could someone look over the enclosed code and see if they
can see why the code isn't working?
I've always had problems in the past getting the focus
from the form to the subform. What's the secret getting
the focus to work from a form to a subform?
Thanks for the help,
Paul
Private Sub RequestedBy_AfterUpdate()
If [frmBedCleaningEntry]![Facility] = "Hazelwood"
Then
PhoneNo = "NA"
ExtNo.SetFocus
End If
If [frmBedCleaningEntry]![Facility] = "Meadows" Then
PhoneNo = "555-1234"
ExtNo = "NA"
CleaningDescrip.SetFocus
End If
If [frmBedCleaningEntry]![Facility] = "Windsong" Then
PhoneNo = "555-2345"
ExtNo = "NA"
CleaningDescrip.SetFocus
End If
If [frmBedCleaningEntry]![Facility] = "DelMaria" Then
PhoneNo = "555-3456"
ExtNo = "NA"
CleaningDescrip.SetFocus
End If
End Sub