Thank you all for helping me!
I have this code but am getting errors:
Private Sub AddSCG_Click()
' Check if number is in the SCGTable
Set rsSCGNumber = New ADODB.Recordset
sSQLSCGNumber = "Select * from SCGTable where SCGNumber = '" & PermNum & "'"
rsSCGNumber.Open sSQLSCGNumber, CurrentProject.Connection
'No Match in SCGTable so go for it
If rsSCGNumber.EOF Then
Set rsTemplate = New ADODB.Recordset
sSQLTemplate = "Update SCGNumber from TempTable where TemplateID = '" & TempNumber & "'"
rsTemplate.Open sSQLTemplate, CurrentProject.Connection
If Not rs.EOF Then
OCADate = DDate
' There is a match so this is an error
MsgBox "Number already taken please try again", vbOKOnly, "Required Data"
A user selects from a dropdown a ticket number, once selected.
the user in another text field inputs another value.
User then clicks on button to update selected record with that value.
I want the code to look at the SCGTable to see if already exist, if so then
Error message to the user letting them know.
If no match in SCGTable I want the update to OCATable
Error message I am receiving:
Run-time error '-2147217900 (80040e14)': Syntax error in UPDATE statement
(I have bold on statement above)
Thank you and Merry Christmas!