S
Steve
Hello! Here's the deal: I have a database with multiple
forms, but for the sake of brevity, let's say I have only
2. I want to move from FormB back to FormA, and I have a
nice little button that does that. However, if I'm on
Record 2 of FormB, I want to go to Record 2 of FormA, if
I'm on Record 3 on FormB, then I want Record 3 of FormA,
etc. Essentially, I want the current record. The problem
is that something is not right with GoToRecord - when I
click the button on FormB, I always seem to end up on
Record 1 of FormA, no matter what Record of FormB I am
working with. I'd appreciate any help in fixing this, and
if it helps, here's the code for the event (one more
thing - the names of the forms for this database
are "Insurance Information Form" and "WinLife Patient
Profile Form," as you'll obviously see):
Private Sub Back_to_Insurance_Info_Command_Click()
On Error GoTo Err_Back_to_Insurance_Info_Command_Click
Dim stDocName As String
Dim stLinkCriteria As String
Dim lcurrentrecnum As Long
stDocName = "Insurance Information Form"
lcurrentrecnum = Forms![WinLife Patient Profile
Form].CurrentRecord
DoCmd.Close ObjectType:=acForm, _
ObjectName:="WinLife Patient Profile Form"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.GoToRecord [ObjectType As acDataForm = acForm],
[stDocName], [Record As AcRecord = acGoTo],
[lcurrentrecnum]
Exit_Back_to_Insurance_Info_Command_Clic:
Exit Sub
Err_Back_to_Insurance_Info_Command_Click:
DoCmd.Close ObjectType:=acForm, _
ObjectName:="WinLife Patient Profile Form"
Resume Exit_Back_to_Insurance_Info_Command_Clic
End Sub
forms, but for the sake of brevity, let's say I have only
2. I want to move from FormB back to FormA, and I have a
nice little button that does that. However, if I'm on
Record 2 of FormB, I want to go to Record 2 of FormA, if
I'm on Record 3 on FormB, then I want Record 3 of FormA,
etc. Essentially, I want the current record. The problem
is that something is not right with GoToRecord - when I
click the button on FormB, I always seem to end up on
Record 1 of FormA, no matter what Record of FormB I am
working with. I'd appreciate any help in fixing this, and
if it helps, here's the code for the event (one more
thing - the names of the forms for this database
are "Insurance Information Form" and "WinLife Patient
Profile Form," as you'll obviously see):
Private Sub Back_to_Insurance_Info_Command_Click()
On Error GoTo Err_Back_to_Insurance_Info_Command_Click
Dim stDocName As String
Dim stLinkCriteria As String
Dim lcurrentrecnum As Long
stDocName = "Insurance Information Form"
lcurrentrecnum = Forms![WinLife Patient Profile
Form].CurrentRecord
DoCmd.Close ObjectType:=acForm, _
ObjectName:="WinLife Patient Profile Form"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.GoToRecord [ObjectType As acDataForm = acForm],
[stDocName], [Record As AcRecord = acGoTo],
[lcurrentrecnum]
Exit_Back_to_Insurance_Info_Command_Clic:
Exit Sub
Err_Back_to_Insurance_Info_Command_Click:
DoCmd.Close ObjectType:=acForm, _
ObjectName:="WinLife Patient Profile Form"
Resume Exit_Back_to_Insurance_Info_Command_Clic
End Sub