I have some code that when I step through it, it works as expected, but when i an just using the ap without stepping into the code it doesn't work as it should. Has anyone encountered this before...here is the code just to help any that I can.
all suggestions are greatly appreciated.
visitdate = Forms![f_bookinghead]![f_BookingHeadForm].Form![BookingDate]
If IsNull(DLookup("bookingdetailid", "bookingdetail", "[bookingheadid] = " & Me.BookingHeadID & " AND [kid] = " & Me.lstKidSelect.Column(0))) Then
'MsgBox "is null"
If Forms![f_bookinghead]![f_BookingHeadForm]![f_BookingDetail].Form![BookingDetailID] > 1 Then
Forms![f_bookinghead]![f_BookingHeadForm]![f_BookingDetail].SetFocus
DoCmd.GoToRecord , , acNewRec
End If
Forms![f_bookinghead]![f_BookingHeadForm]![f_BookingDetail].Form![KID] = Me.lstKidSelect.Column(0)
bday = Me.lstKidSelect.Column(4)
Forms![f_bookinghead]![f_BookingHeadForm]![f_BookingDetail].Form![lblAge].Caption = Int(DateDiff("d", bday, visitdate) / 365)
Forms![f_bookinghead]![f_BookingHeadForm]![f_BookingDetail].Form![SignInID] = Forms![f_login].SignInID
Forms![f_bookinghead]![f_BookingHeadForm]![f_BookingDetail].Enabled = True
Forms![f_bookinghead]![f_BookingHeadForm]![f_BookingDetail].Form!BookingHeadID = Me.BookingHeadID
Forms![f_bookinghead]![f_BookingHeadForm]![f_BookingDetail].Form!cboSkiType.SetFocus
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
'BookingLstRefresh
Else
bdID = DLookup("bookingdetailid", "bookingdetail", "[bookingheadid] = " & Me.BookingHeadID & " AND [kid] = " & Me.lstKidSelect.Column(0))
Forms![f_bookinghead]![f_BookingHeadForm]![f_BookingDetail].Form!cboSkiType.SetFocus
Me.Filter = bdID
Me.FilterOn = True
End If
the problem that is occuring is this...
when I am running the program normally the subform f_bookingheadform goes to a new record(wrong). When I step through the code, the sub-subform f_bookingdetail goes to a new record(correct). It's as if when the code is being run normally the setfocus event doesn't have time to set the focus.
Again, any suggestions would be greatly appreciated.
thank
Jeremy
all suggestions are greatly appreciated.
visitdate = Forms![f_bookinghead]![f_BookingHeadForm].Form![BookingDate]
If IsNull(DLookup("bookingdetailid", "bookingdetail", "[bookingheadid] = " & Me.BookingHeadID & " AND [kid] = " & Me.lstKidSelect.Column(0))) Then
'MsgBox "is null"
If Forms![f_bookinghead]![f_BookingHeadForm]![f_BookingDetail].Form![BookingDetailID] > 1 Then
Forms![f_bookinghead]![f_BookingHeadForm]![f_BookingDetail].SetFocus
DoCmd.GoToRecord , , acNewRec
End If
Forms![f_bookinghead]![f_BookingHeadForm]![f_BookingDetail].Form![KID] = Me.lstKidSelect.Column(0)
bday = Me.lstKidSelect.Column(4)
Forms![f_bookinghead]![f_BookingHeadForm]![f_BookingDetail].Form![lblAge].Caption = Int(DateDiff("d", bday, visitdate) / 365)
Forms![f_bookinghead]![f_BookingHeadForm]![f_BookingDetail].Form![SignInID] = Forms![f_login].SignInID
Forms![f_bookinghead]![f_BookingHeadForm]![f_BookingDetail].Enabled = True
Forms![f_bookinghead]![f_BookingHeadForm]![f_BookingDetail].Form!BookingHeadID = Me.BookingHeadID
Forms![f_bookinghead]![f_BookingHeadForm]![f_BookingDetail].Form!cboSkiType.SetFocus
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
'BookingLstRefresh
Else
bdID = DLookup("bookingdetailid", "bookingdetail", "[bookingheadid] = " & Me.BookingHeadID & " AND [kid] = " & Me.lstKidSelect.Column(0))
Forms![f_bookinghead]![f_BookingHeadForm]![f_BookingDetail].Form!cboSkiType.SetFocus
Me.Filter = bdID
Me.FilterOn = True
End If
the problem that is occuring is this...
when I am running the program normally the subform f_bookingheadform goes to a new record(wrong). When I step through the code, the sub-subform f_bookingdetail goes to a new record(correct). It's as if when the code is being run normally the setfocus event doesn't have time to set the focus.
Again, any suggestions would be greatly appreciated.
thank
Jeremy