PDA

Click to See Complete Forum and Search --> : DataCombo to insert in table if not there


Caro
Aug 19th, 1999, 07:32 PM
Hi, I'm using a data combo drop-down to search an access table for a value which is then entered into the field on my database. It works great as when I type in the first few letters I get to those ones in the table.
What I would like to do is if the user types in a value which doesn't exist, to ask them whether they want to add that value to the table and if yes, create another entry in the table I'm looking up. As well as populating the databae field.
Any ideas? Thanks a lot.

JHausmann
Aug 19th, 1999, 08:41 PM
Something like this?


if err.num= ## then ' use error that is returned when no record exists
err.clr
str= "The value you've entered does not exist, do you wish to add it?"
rtn = msgbox(str, vbyesno)
if rtn = vbyes then
'call subroutine to add data into table
datacontrol.refresh
end if
end if


[This message has been edited by JHausmann (edited 08-20-1999).]