Essentially, I have a listbox ,based on a union query, on a form {whose recordsourse is different from the listbox}
which displays records from 3 tables. the RecordNumber
from each table has a unique Identifying letter as the
first character in the record number itself:
ie.. tbl1 REC# = D000001 | tbl2 REC# = G000001 |tbl3 REC# = F000001.
What I wish to acheive is: upon selecting (Clicking on)
a particular record(row)in the Listbox, and depending on
which letter the RecordNumber starts with,open a form which
corresponds to the table in which the record resides.
The RecordNumber is the first Column being displayed in the
listbox and is the primarykey for the respective tables the
records are "pulled" from.
However, I'm not sure how to specify the following:
The Column (RecordNumber)in the row selected(clicked on)
Checking which "letter" the Rec# starts with.
below is a "code" logic example of what I hope to acheive.
any suggestions on where to look or research how to do
this??
Private Sub List35_Click()
On Error GoTo List35_Click_err
If (IsNull([RecordNumber]) Or [RecordNumber] = ""
Then
GoTo List35_Click_Exit:
ElseIf [RecordNumber] = "D" Then
DoCmd.OpenForm "frmPCADomestic", acNormal, , , acFormAdd
ElseIf [RecordNumber] = "G" Then
DoCmd.OpenForm "frmPCAGlobal", acNormal, , , acFormAdd
ElseIf [RecordNumber] = "F" Then
DoCmd.OpenForm "frmFYINotices", acNormal, , , acFormAdd
Else
End If
List35_Click_Exit:
Exit Sub
List35_Click_err:
MsgBox Err.Number
MsgBox Err.Description
Resume List35_Click_Exit
End Sub
Thank you,
Jim
which displays records from 3 tables. the RecordNumber
from each table has a unique Identifying letter as the
first character in the record number itself:
ie.. tbl1 REC# = D000001 | tbl2 REC# = G000001 |tbl3 REC# = F000001.
What I wish to acheive is: upon selecting (Clicking on)
a particular record(row)in the Listbox, and depending on
which letter the RecordNumber starts with,open a form which
corresponds to the table in which the record resides.
The RecordNumber is the first Column being displayed in the
listbox and is the primarykey for the respective tables the
records are "pulled" from.
However, I'm not sure how to specify the following:
The Column (RecordNumber)in the row selected(clicked on)
Checking which "letter" the Rec# starts with.
below is a "code" logic example of what I hope to acheive.
any suggestions on where to look or research how to do
this??
Private Sub List35_Click()
On Error GoTo List35_Click_err
If (IsNull([RecordNumber]) Or [RecordNumber] = ""
GoTo List35_Click_Exit:
ElseIf [RecordNumber] = "D" Then
DoCmd.OpenForm "frmPCADomestic", acNormal, , , acFormAdd
ElseIf [RecordNumber] = "G" Then
DoCmd.OpenForm "frmPCAGlobal", acNormal, , , acFormAdd
ElseIf [RecordNumber] = "F" Then
DoCmd.OpenForm "frmFYINotices", acNormal, , , acFormAdd
Else
End If
List35_Click_Exit:
Exit Sub
List35_Click_err:
MsgBox Err.Number
MsgBox Err.Description
Resume List35_Click_Exit
End Sub
Thank you,
Jim