G
Guest
I am using a database to track new tasks in our office and I am using a cbo
to allocate each new task to an office staff member. This is based on
tblAllocation which is linked to tblTask. I wish to be able to enter new
names to the cbo from the form. I have used the following code on other
databases for this same purpose but on this occasion I am stuck. It is
NotInList.
Private Sub Combo55_NotInList(NewData As String, Response As Integer)
Dim db As Database
Set db = CurrentDb
'Ask the user if they want to add to the list
If MsgBox("Do you want to add this entity to the list?", vbYesNo +
vbQuestion, "Add new value?") = vbYes Then
'The user clicked Yes - add the new value
db.Execute "INSERT INTO tblAllocation (Allocated Person) VALUES (""" &
NewData & """)", dbFailOnError
'Tell Access you've added the new value
Response = acDataErrAdded
Else
'The user clicked No - discard the new value
Me.Combo55.Undo
'Tell Access you've discarded the new value
Response = acDataErrContinue
End If
I keep getting a compile error highlighting second line of code, stating
User-defined type not defined.
any assistance appreciated. Apologies if this is not too clear but am very
new to Access.
thanks
Steven
to allocate each new task to an office staff member. This is based on
tblAllocation which is linked to tblTask. I wish to be able to enter new
names to the cbo from the form. I have used the following code on other
databases for this same purpose but on this occasion I am stuck. It is
NotInList.
Private Sub Combo55_NotInList(NewData As String, Response As Integer)
Dim db As Database
Set db = CurrentDb
'Ask the user if they want to add to the list
If MsgBox("Do you want to add this entity to the list?", vbYesNo +
vbQuestion, "Add new value?") = vbYes Then
'The user clicked Yes - add the new value
db.Execute "INSERT INTO tblAllocation (Allocated Person) VALUES (""" &
NewData & """)", dbFailOnError
'Tell Access you've added the new value
Response = acDataErrAdded
Else
'The user clicked No - discard the new value
Me.Combo55.Undo
'Tell Access you've discarded the new value
Response = acDataErrContinue
End If
I keep getting a compile error highlighting second line of code, stating
User-defined type not defined.
any assistance appreciated. Apologies if this is not too clear but am very
new to Access.
thanks
Steven