Sorry, but I don't really understand what problem you're encountering! Isit
that you're seeing the PPMIP value in the CRN combo box, instead of the CRN
values? The RowSource for the CRN combo box has seven fields in it: have you
set the ColumnCount to 7?
--
Doug Steele, Microsoft Access MVPhttp://I.Am/DougSteele
(no private e-mails, please)
Aaaaagggggghhhhhhh!
I'm now at a loss as to what's happening.
I've renamed some fields for clarity and here's what I have, based on
the entries here:
My form has a RecordSource of tbl_All_UTR_20090629
PPMIP has a RowSource of:
SELECT tbl_All_UTR_20090629.fldPPMIP
FROM tbl_All_UTR_20090629
GROUP BY tbl_All_UTR_20090629.fldPPMIP;
BoundColumn = 1
ControlSource = fldPPMIP
It has an AfterUpdate event as follows, after following Dougs
suggestion:
Private Sub PPMIP_AfterUpdate()
Dim sSQL As String
sSQL = "SELECT [fldPPMIP]," & _
" [fldCRN]," & _
" [fldAMT]," & _
" [fldProperDate], " & _
" [fldMSN], " & _
" [fldMSN2], " & _
" [fldSCNO] " & _
"FROM tbl_All_UTR_20090629 " & _
"WHERE [fldPPMIP] = '" & Me.PPMIP.Value & "'"
Me.CRN.RowSource = sSQL
Me.CRN.Requery
End Sub
CRN has a ControlSource of fldCRN and no RowSource.
Now, when I run the form and select a value form the PPMIP field,
moving to the CRN field and accessing the combo, shows me a list
containing the PPMIP that was selected in the previous field. This
value would, I am guessing, appear for as many times as there is a CRN
against the particular PPMIP. Tracing through the VBA for the
AfterUpdate, gives the following for the sSQL value:
"SELECT [fldPPMIP], [fldCRN], [fldAMT], [fldProperDate], [fldMSN],
[fldMSN2], [fldSCNO] FROM tbl_All_UTR_20090629 WHERE [fldPPMIP] =
'TMIDE'"
Which all looks fine, considering I selected TMIDE as the PPMIP value.
Can someone advise as to what's going wrong with this thing, as it's
driving me mental!!!
Many, many TIA.
Duncs
I'm guessing that PPMIP is a text field. If that's the case, you need
quotes
around the value:
"WHERE [tbl_All_UTR_20090629].[PPMIP] = '" & Me.cboPPMIP & "'"
Exagerated for clarity, that's
"WHERE [tbl_All_UTR_20090629].[PPMIP] = ' " & Me.cboPPMIP & " ' "
"Duncs" <
[email protected]> wrote in message
Nope, it's still not working.
I've got the Bound column set to 1. But, like before, when I select a
company code from cboPPMIP and activate the cboCRN dropdown, a
parameter window appears with a title of the company code I selected
prior to activating it. If I then enter the code that I previously
selected, it then displays the CRNs associated with the company code.
cboCompany
RowSource - SELECT tblPPMIP.PPMIP FROM tblPPMIP ORDER BY [PPMIP];
----------------------------Make Sure u have Bound column of
cboCompany set to 1 as there is only one column.
AfterUpdate -
Private Sub cboPPMIP_AfterUpdate()
Dim sSQL As String
sSQL = "SELECT [tbl_All_UTR_20090629].[PPMIP]," & _
" [tbl_All_UTR_20090629].[CRN]," & _
" [tbl_All_UTR_20090629].[AMT]," & _
" [tbl_All_UTR_20090629].[ProperDate], " & _
" [tbl_All_UTR_20090629].[MSN], " & _
" [tbl_All_UTR_20090629].[MSN2], " & _
" [tbl_All_UTR_20090629].[SCNO] " & _
"FROM tbl_All_UTR_20090629 " & _
"WHERE [tbl_All_UTR_20090629].[PPMIP] = " &
Me.cboPPMIP.Value
------------------------------ Is it cboPPMIP or cboCompany as said
in ur first line of code...
Me.cboCRN.RowSource = sSQL
Me.cboCRN.Requery
End Sub
cboCRN
RowSource - SELECT tbl_All_UTR_20090629.CRN, tbl_All_UTR_20090629.AMT,
tbl_All_UTR_20090629.ProperDate, tbl_All_UTR_20090629.MSN,
tbl_All_UTR_20090629.MSN2, tbl_All_UTR_20090629.SCNO FROM
tbl_All_UTR_20090629;
I'm at a loss as to what's wrong so would appreciate some help.
TIA
Duncs- Hide quoted text -
- Show quoted text -- Hide quoted text -
- Show quoted text -- Hide quoted text -
- Show quoted text -