If you were not able to understand my shorthand:
How to have a record selected from a listbox on one form
open another form displaying the selected record?
I presently have the following code, (in the onDblClick
event of the ListBox)which does open the correct form
properly. ( there are 4 forms with select case deciding
which one should be opened) However, I can not figure out
how to use the selected record to "goto" the same record
in the second form.
CODE:
Private Sub List35_DblClick(Cancel As Integer)
On Error GoTo List35_DblClick_err
Dim sRec As String
sRec = List35.Value
sRec = Mid$(sRec, 1, 1) ' this will give the 'D','G','A', or 'F' (1st character of an alphanumeric id number{primary key}for the record)
Select Case sRec
Case "A"
DoCmd.OpenForm "frmDataEntry", , , , acFormEdit, , [RecordNumber] = [Forms]![FrmSprvsr]![List35].Value
Case "D"
DoCmd.OpenForm "frmPCADomestic", , , , acFormEdit, , [RecordNumber] = [Forms]![FrmSprvsr]![List35].Value
Case "G"
DoCmd.OpenForm "frmPCAGlobal", , , , acFormEdit, , [RecordNumber] = [Forms]![FrmSprvsr]![List35].Value
Case "F"
DoCmd.OpenForm "frmFYINotices", , , , acFormEdit, , [RecordNumber] = [Forms]![FrmSprvsr]![List35].Value
Case ""
GoTo List35_DblClick_Exit:
End Select
List35_DblClick_Exit:
Exit Sub
List35_DblClick_err:
MsgBox Err.Number
MsgBox Err.Description
End Sub
I'm not sure whether the "Whereclause" or "OpenArgs" should
be used. Or if I should call somekind of Function.
I have tried the above code, it does not "goto" the
selected record.
any suggestions?
Thanks,
Jim
How to have a record selected from a listbox on one form
open another form displaying the selected record?
I presently have the following code, (in the onDblClick
event of the ListBox)which does open the correct form
properly. ( there are 4 forms with select case deciding
which one should be opened) However, I can not figure out
how to use the selected record to "goto" the same record
in the second form.
CODE:
Private Sub List35_DblClick(Cancel As Integer)
On Error GoTo List35_DblClick_err
Dim sRec As String
sRec = List35.Value
sRec = Mid$(sRec, 1, 1) ' this will give the 'D','G','A', or 'F' (1st character of an alphanumeric id number{primary key}for the record)
Select Case sRec
Case "A"
DoCmd.OpenForm "frmDataEntry", , , , acFormEdit, , [RecordNumber] = [Forms]![FrmSprvsr]![List35].Value
Case "D"
DoCmd.OpenForm "frmPCADomestic", , , , acFormEdit, , [RecordNumber] = [Forms]![FrmSprvsr]![List35].Value
Case "G"
DoCmd.OpenForm "frmPCAGlobal", , , , acFormEdit, , [RecordNumber] = [Forms]![FrmSprvsr]![List35].Value
Case "F"
DoCmd.OpenForm "frmFYINotices", , , , acFormEdit, , [RecordNumber] = [Forms]![FrmSprvsr]![List35].Value
Case ""
GoTo List35_DblClick_Exit:
End Select
List35_DblClick_Exit:
Exit Sub
List35_DblClick_err:
MsgBox Err.Number
MsgBox Err.Description
End Sub
I'm not sure whether the "Whereclause" or "OpenArgs" should
be used. Or if I should call somekind of Function.
I have tried the above code, it does not "goto" the
selected record.
any suggestions?
Thanks,
Jim