A
Angi
My second cbo is dependent on the first. I want the user to be able to
create a new subclass if notinlist. The error I'm getting is
Too few parameters. Expected 1.
on the Execute MySql line.
It was 2 but I change the NewData to '" & NewData &"' and now it's one.
I tried doing the same to CurCID but then I get a data type
mismatch...string instead of integer. I tried Int(curCID) but that
didn't work either. What is it that I need here?
TIA!
Private Sub cboSubClass_NotInList(NewData As String, Response As
Integer)
Dim MySql As String
Dim CurCID As Integer
Beep
CurCID = Me.cboClass.Column(0)
If MsgBox("'" & NewData & "' is currently not an existing subclass.
" & vbCrLf _
& "Would you like to add '" & NewData & "' to the
menu?", vbInformation + vbOKCancel, "Info") = vbOK Then
MySql = "INSERT INTO Subclass ( ClassID, SubClassName ) SELECT
Subclass.ClassID, Subclass.SubClassName FROM Subclass " & _
"WHERE (((Subclass.ClassID)= CurCID ) AND ((Subclass.SubClassName)=
'" & NewData & "' ));"
CurrentDb.Execute MySql
Response = acDataErrAdded
Else
Response = acDataErrContinue
Me.cboClass = Null
End If
End Sub
create a new subclass if notinlist. The error I'm getting is
Too few parameters. Expected 1.
on the Execute MySql line.
It was 2 but I change the NewData to '" & NewData &"' and now it's one.
I tried doing the same to CurCID but then I get a data type
mismatch...string instead of integer. I tried Int(curCID) but that
didn't work either. What is it that I need here?
TIA!
Private Sub cboSubClass_NotInList(NewData As String, Response As
Integer)
Dim MySql As String
Dim CurCID As Integer
Beep
CurCID = Me.cboClass.Column(0)
If MsgBox("'" & NewData & "' is currently not an existing subclass.
" & vbCrLf _
& "Would you like to add '" & NewData & "' to the
menu?", vbInformation + vbOKCancel, "Info") = vbOK Then
MySql = "INSERT INTO Subclass ( ClassID, SubClassName ) SELECT
Subclass.ClassID, Subclass.SubClassName FROM Subclass " & _
"WHERE (((Subclass.ClassID)= CurCID ) AND ((Subclass.SubClassName)=
'" & NewData & "' ));"
CurrentDb.Execute MySql
Response = acDataErrAdded
Else
Response = acDataErrContinue
Me.cboClass = Null
End If
End Sub