Hi,
I am using Access 2007.
I have a simple table with 2 fields [Case] and [Target]
My form has a list box populated with Case Types, a text box for the user to input the Target number for the selected Case and a button that i need to run queries to update the table on click.
The table could start blank and i don't want any duplicates, so the 2 queries i think i need to run are:
1. To check if a certain Case exists and if so update the Target with what the user has input.
2 If the Case doesn't already have a target to update, the new Case and Target need to be inserted.
I'm running them from VB as:
DoCmd.RunSQL "UPDATE CaseTarget SET [Target] = ('" & Forms!MainMenu!CTargetText & "') WHERE [Case] = ('" & Forms!MainMenu!CallList & "');"
DoCmd.RunSQL "INSERT INTO CaseTarget (Case, Target) VALUES (('" & Forms!MainMenu!CallList & "'), ('" & Forms!MainMenu!CTargetText & "'));"
But how do i say if there is no Case to Update, then Insert?
Thanks
Chris