B
BFish via AccessMonster.com
I have set a main form to lookup a record and when found checks for two
values in that record from controls. If true then setting focus to linked
subform to add an invoice set to acNew. If false I need the focus set back
to the main form controls (which all is currently working) for correct user
input, but still set the subform to acNew. This form stays open until all
main form records are entered or updated, so I need this to occur for
everytime a lookup is performed. Additionally the subform's record source is
a table. I am having trouble in setting the object in the DoCmd.GoToRecord, ?
?????,acNew and/or placement in the code.
Private Sub Combo40_AfterUpdate()
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[BusinessInformationID] = " & Str(Nz(Me![Combo40], 0))
Me.Bookmark = rs.Bookmark
If Not IsNull([BUSINESS NAME]) Then
If CodingID = 1137468902 Or IsNull(CodingID) Or PayCodeID = 0 Or
IsNull(PayCodeID) Then
If CodingID <> 1137468902 And PayCodeID = 0 Or IsNull
(PayCodeID) Then
PayCodeID.SetFocus
Else
CodingID.SetFocus
End If
Else
Me![Invoice Entry].SetFocus
Me![Invoice Entry].Form![Invoice Number].SetFocus
DoCmd.GoToRecord , , acNewRec
End If
End If
rs.Close
End Sub
As is now will go to the new record on the subform when IF statements are
False, I think proper placement is after the last End If but having trouble
referencing the form or table to go to the new record with setting focus.
Can anyone help!
Thanks,
Bill Fischer
values in that record from controls. If true then setting focus to linked
subform to add an invoice set to acNew. If false I need the focus set back
to the main form controls (which all is currently working) for correct user
input, but still set the subform to acNew. This form stays open until all
main form records are entered or updated, so I need this to occur for
everytime a lookup is performed. Additionally the subform's record source is
a table. I am having trouble in setting the object in the DoCmd.GoToRecord, ?
?????,acNew and/or placement in the code.
Private Sub Combo40_AfterUpdate()
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[BusinessInformationID] = " & Str(Nz(Me![Combo40], 0))
Me.Bookmark = rs.Bookmark
If Not IsNull([BUSINESS NAME]) Then
If CodingID = 1137468902 Or IsNull(CodingID) Or PayCodeID = 0 Or
IsNull(PayCodeID) Then
If CodingID <> 1137468902 And PayCodeID = 0 Or IsNull
(PayCodeID) Then
PayCodeID.SetFocus
Else
CodingID.SetFocus
End If
Else
Me![Invoice Entry].SetFocus
Me![Invoice Entry].Form![Invoice Number].SetFocus
DoCmd.GoToRecord , , acNewRec
End If
End If
rs.Close
End Sub
As is now will go to the new record on the subform when IF statements are
False, I think proper placement is after the last End If but having trouble
referencing the form or table to go to the new record with setting focus.
Can anyone help!
Thanks,
Bill Fischer