C
Chris Lines
Guys - To date, I have resolved all my questions through research on this
fabulous forum, but I can't get to the bottom of my latest issue. I would
appreciate help, so I can finally get some sleep ...
I'm trying to synchronise 4 cbo on a single form called frmTasks. Here are
the tables and cbo names in order for synchronisation:
tblCCPMFunction ==> cboCCPMFunction
tblCCPMCrimeType ==> cboCCPMCrimeType
tblCCPMIncidentType ==> cboCCPMIncidentType
tbleCCPMIncidentDescription ==> cboCCPMIncidentDescription
Bound col for cboFunction is CCPMFunctionID, which is auto number data type.
Row source for cboCCPMFunction is:
SELECT [tblCCPMFunction].CCPMFunctionID, [tblCCPMFunction].CCPMFunction FROM
[tblCCPMFunction] ORDER BY [tblCCPMFunction].CCPMFunction;
CCPMFunction works and lists the data I want. I have found variations on the
code to synchronise the 2nd cbo (using the AfterUpdate Event in
cboCCPMFunction), but have used the following because I understand it the
best:
Option Compare Database
Option Explicit
Private Sub cboCCPMFunction_AfterUpdate()
'Update the row source of the cboCCPMCrimeType combo box
'when the user makes a selection in the cboCCPMFunction
'combo box.
Me.cboCCPMCrimeType.RowSource = "SELECT CCPMCrimeType FROM" & _
" tblCCPMCrimeType WHERE CCPMFunctionID = " & Me.cboCCPMFunction & _
" ORDER BY CCPMCrimeType"
Me.cboCCPMCrimeType = Me.cboCCPMCrimeType.ItemData(0)
Me.cboCCPMCrimeType.Requery
End Sub
The second cbo (cboCCPMCrimeType) does not provide a result ... the list is
blank. And since adding the requery line, I am now getting an error advising
that I have a syntax error in FROM clause. But my research tells me that I
need to requery the 2nd, 3rd, and 4th cbo. I have not yet tried writing any
code for the 3rd or 4th cbo.
Where am I going wrong? Is it because the data type is a number rather than
text? Or have I coded incorrectly? I just can't figure it out and would very
much appreciate help pls. Advice on how to make all four cbo would be ideal
if that's possible.
Thanks in advance - Chris
fabulous forum, but I can't get to the bottom of my latest issue. I would
appreciate help, so I can finally get some sleep ...
I'm trying to synchronise 4 cbo on a single form called frmTasks. Here are
the tables and cbo names in order for synchronisation:
tblCCPMFunction ==> cboCCPMFunction
tblCCPMCrimeType ==> cboCCPMCrimeType
tblCCPMIncidentType ==> cboCCPMIncidentType
tbleCCPMIncidentDescription ==> cboCCPMIncidentDescription
Bound col for cboFunction is CCPMFunctionID, which is auto number data type.
Row source for cboCCPMFunction is:
SELECT [tblCCPMFunction].CCPMFunctionID, [tblCCPMFunction].CCPMFunction FROM
[tblCCPMFunction] ORDER BY [tblCCPMFunction].CCPMFunction;
CCPMFunction works and lists the data I want. I have found variations on the
code to synchronise the 2nd cbo (using the AfterUpdate Event in
cboCCPMFunction), but have used the following because I understand it the
best:
Option Compare Database
Option Explicit
Private Sub cboCCPMFunction_AfterUpdate()
'Update the row source of the cboCCPMCrimeType combo box
'when the user makes a selection in the cboCCPMFunction
'combo box.
Me.cboCCPMCrimeType.RowSource = "SELECT CCPMCrimeType FROM" & _
" tblCCPMCrimeType WHERE CCPMFunctionID = " & Me.cboCCPMFunction & _
" ORDER BY CCPMCrimeType"
Me.cboCCPMCrimeType = Me.cboCCPMCrimeType.ItemData(0)
Me.cboCCPMCrimeType.Requery
End Sub
The second cbo (cboCCPMCrimeType) does not provide a result ... the list is
blank. And since adding the requery line, I am now getting an error advising
that I have a syntax error in FROM clause. But my research tells me that I
need to requery the 2nd, 3rd, and 4th cbo. I have not yet tried writing any
code for the 3rd or 4th cbo.
Where am I going wrong? Is it because the data type is a number rather than
text? Or have I coded incorrectly? I just can't figure it out and would very
much appreciate help pls. Advice on how to make all four cbo would be ideal
if that's possible.
Thanks in advance - Chris