G
Guest
I have two tables. One with Categories and one with the categories ID linked in as a foreign key (basetable). I then use a lookup and hides the ID field to get a string shown in my form.
When the Category typed is not in the category list, I would like it automaticly added to the Category table. and used as dataentry and now beeing part of the list for the next entry (could be used in another table/form). Also I would like the MS error message Not In List not showing up!
I guess I am going to do something in the NotInList event ... I posted a question yesterday and thanks to Jonathan I got the code in the bottom of this letter. I have worked with it and I can sinmply not get a grasp on it (probably since I am very novice when it comes to VB)
Any simple ideas out there?
Best wishes Reno Lindberg
I erased some linebreaks and added As String in the private sub cboActivity_NotInList(NewData As String,Response As String). AND I changed the names of cboActivity, Activity, New Activity etc ....But it will simply not run
FromJonathan;
private sub cboActivity_NotInList(NewData,Response)
dim rst as recordset
if msgbox(newdata & "... not in list, add
it?",vbokcancel,"New Activity")=vbok then
set rst=....
with rst
.addnew
.fields("Activity")=newdata
.update
.close
end with
set rst=nothing
response=acdataerradded
else
response=acdataerrcontinue
end if
end sub
When the Category typed is not in the category list, I would like it automaticly added to the Category table. and used as dataentry and now beeing part of the list for the next entry (could be used in another table/form). Also I would like the MS error message Not In List not showing up!
I guess I am going to do something in the NotInList event ... I posted a question yesterday and thanks to Jonathan I got the code in the bottom of this letter. I have worked with it and I can sinmply not get a grasp on it (probably since I am very novice when it comes to VB)
Any simple ideas out there?
Best wishes Reno Lindberg
I erased some linebreaks and added As String in the private sub cboActivity_NotInList(NewData As String,Response As String). AND I changed the names of cboActivity, Activity, New Activity etc ....But it will simply not run
FromJonathan;
private sub cboActivity_NotInList(NewData,Response)
dim rst as recordset
if msgbox(newdata & "... not in list, add
it?",vbokcancel,"New Activity")=vbok then
set rst=....
with rst
.addnew
.fields("Activity")=newdata
.update
.close
end with
set rst=nothing
response=acdataerradded
else
response=acdataerrcontinue
end if
end sub