S
Slez via AccessMonster.com
I'm having a bit of difficulty trying to get a multi select list box to
display related records to a form's control. I would like to achieve one of
two different options. I'm hoping that my explanation makes enough sense
that someone can offer their opinion of what is the proper way to set this up.
I have a control on frmMainScreen called cboProjectName. Its Row Source is:
SELECT Project.ProjectID, Project.ProjectName FROM Project ORDER BY
ProjectName;
On that form is a subform called frmProjectSubformTab, which has a tab
control on it. On those tabs are various controls and forms which display
related records to whatever is selected in cboProjectName. I wish to add
another subform called frmEstimateSelector to one of the tabs which will
serve as a place where users can select 1 or multiple records and print
various reports listed in an Option Group.
Here's where the option comes in. I believe I can either reference
cboProjectName on frmMainScreen OR a control ProjectID on frmEstimateSelector.
I've been doing some trial and error and can't quite get the proper records
to display. My multi select list box is named "lstBidSelect", and its Row
Source is currently:
SELECT Bid.BidNumber, Bid.BidType, Bid.BidStatus FROM Bid WHERE (((Bid.
ProjectID)=[Forms]![frmEstimateSelector]![ProjectID])) ORDER BY BidNumber;
I have been partially successful when I had the following:
...WHERE (((Bid.ProjectID)=[Forms]![frmMainScreen]![cboProjectName]))...
It displayed the correct records when I opened frmEstimateSelector on its own,
but not when I viewed it through frmMainScreen.
I also have the following event in the control ProjectID on
frmEstimateSelector, but I don't know if that is necessary to return the
related records:
Private Sub ProjectID_AfterUpdate()
On Error Resume Next
lstBidSelect.RowSource = "Select Bid.BidNumber " & _
"FROM Bid " & _
"WHERE Bid.ProjectID = " & Me.ProjectID & _
" ORDER BY Bid.BidNumber;"
End Sub
I am quite certain my Row Source is incorrect, and welcome any guidance!
Slez
display related records to a form's control. I would like to achieve one of
two different options. I'm hoping that my explanation makes enough sense
that someone can offer their opinion of what is the proper way to set this up.
I have a control on frmMainScreen called cboProjectName. Its Row Source is:
SELECT Project.ProjectID, Project.ProjectName FROM Project ORDER BY
ProjectName;
On that form is a subform called frmProjectSubformTab, which has a tab
control on it. On those tabs are various controls and forms which display
related records to whatever is selected in cboProjectName. I wish to add
another subform called frmEstimateSelector to one of the tabs which will
serve as a place where users can select 1 or multiple records and print
various reports listed in an Option Group.
Here's where the option comes in. I believe I can either reference
cboProjectName on frmMainScreen OR a control ProjectID on frmEstimateSelector.
I've been doing some trial and error and can't quite get the proper records
to display. My multi select list box is named "lstBidSelect", and its Row
Source is currently:
SELECT Bid.BidNumber, Bid.BidType, Bid.BidStatus FROM Bid WHERE (((Bid.
ProjectID)=[Forms]![frmEstimateSelector]![ProjectID])) ORDER BY BidNumber;
I have been partially successful when I had the following:
...WHERE (((Bid.ProjectID)=[Forms]![frmMainScreen]![cboProjectName]))...
It displayed the correct records when I opened frmEstimateSelector on its own,
but not when I viewed it through frmMainScreen.
I also have the following event in the control ProjectID on
frmEstimateSelector, but I don't know if that is necessary to return the
related records:
Private Sub ProjectID_AfterUpdate()
On Error Resume Next
lstBidSelect.RowSource = "Select Bid.BidNumber " & _
"FROM Bid " & _
"WHERE Bid.ProjectID = " & Me.ProjectID & _
" ORDER BY Bid.BidNumber;"
End Sub
I am quite certain my Row Source is incorrect, and welcome any guidance!
Slez