N
negativeB
I know that the cascading combo box issue has been addressed quite a
bit on the various message boards and groups, but I'm stuck. I have
successfully set up a series of two cascading boxes. The filtered box
returns a first name and a last name, both from two different columns
of the same table.
However, this is where my problems start.
What I would like to do is turn the first and last name into just
NAME. (i.e. Me.lblTitle.Caption = "" & [FirstName] & " " & [LastName]
& "") Is there any way to achieve this within my SQL statement in the
VB code? Or is it a control issue?
And secondly... When the filtered combo box returns a null value or an
empty recordset, I get a 2105 runtime error when I try to go to a new
record. Here's the code.
The Combo boxes...
Private Sub cmbCompany_AfterUpdate()
If Len(cmbCompany) > 0 Then
With cmbContact
.RowSource = _
"Select ContactID, FirstName, LastName " & _
"From tblContacts where CompanyID = " & cmbCompany
.Requery
.SetFocus
.Dropdown
End With
End If
End Sub
The Save/New Record button...
Private Sub cmdSave_Click()
DoCmd.Save acForm, "frmCalls"
DoCmd.GoToRecord , , acNewRec
End Sub
Either, I am not understanding the problem, or the code is wrong. Is
there any way to find out how many records were returned after
the .requery? And if so, if that number were zero, what is the best
way to handle that error? Or am I all messed up?
bit on the various message boards and groups, but I'm stuck. I have
successfully set up a series of two cascading boxes. The filtered box
returns a first name and a last name, both from two different columns
of the same table.
However, this is where my problems start.
What I would like to do is turn the first and last name into just
NAME. (i.e. Me.lblTitle.Caption = "" & [FirstName] & " " & [LastName]
& "") Is there any way to achieve this within my SQL statement in the
VB code? Or is it a control issue?
And secondly... When the filtered combo box returns a null value or an
empty recordset, I get a 2105 runtime error when I try to go to a new
record. Here's the code.
The Combo boxes...
Private Sub cmbCompany_AfterUpdate()
If Len(cmbCompany) > 0 Then
With cmbContact
.RowSource = _
"Select ContactID, FirstName, LastName " & _
"From tblContacts where CompanyID = " & cmbCompany
.Requery
.SetFocus
.Dropdown
End With
End If
End Sub
The Save/New Record button...
Private Sub cmdSave_Click()
DoCmd.Save acForm, "frmCalls"
DoCmd.GoToRecord , , acNewRec
End Sub
Either, I am not understanding the problem, or the code is wrong. Is
there any way to find out how many records were returned after
the .requery? And if so, if that number were zero, what is the best
way to handle that error? Or am I all messed up?