G
Guest
Hi,
I am a form with a Listbox and a command button. When an user clicks on
the button an inputbox will appear to prompt for name of the new item to be
added into a table. Then it'll requery the listbox so it'll have the latest
entries. Here is the code for the cmdbtn:
Dim sRockName As String
Dim mySQL As String
sRockName = InputBox("New Rock ID", "Add Rock")
mySQL = "INSERT INTO ROCK (ROCKNAME)"
mySQL = mySQL + " VALUES ('" + sRockName + "')"
DoCmd.SetWarnings False
DoCmd.RunSQL mySQL
DoCmd.SetWarnings True
ListRocks.Requery
The problem I am having is 1) when the warning is set to "on" the user will
get a prompt to confirm whether or not to add the new item. - it's kinda
annoying... 2) When I have the setting turn off.. the user won't see the
error when they enter a name that's already exist. Is it a way to get
around it?
Thanks
I am a form with a Listbox and a command button. When an user clicks on
the button an inputbox will appear to prompt for name of the new item to be
added into a table. Then it'll requery the listbox so it'll have the latest
entries. Here is the code for the cmdbtn:
Dim sRockName As String
Dim mySQL As String
sRockName = InputBox("New Rock ID", "Add Rock")
mySQL = "INSERT INTO ROCK (ROCKNAME)"
mySQL = mySQL + " VALUES ('" + sRockName + "')"
DoCmd.SetWarnings False
DoCmd.RunSQL mySQL
DoCmd.SetWarnings True
ListRocks.Requery
The problem I am having is 1) when the warning is set to "on" the user will
get a prompt to confirm whether or not to add the new item. - it's kinda
annoying... 2) When I have the setting turn off.. the user won't see the
error when they enter a name that's already exist. Is it a way to get
around it?
Thanks