This is the first I have tried using an input box, so I have a strong feeling I am using it incorrectly.
I am trying to use the input box to allow the user to set a value for a field. In this case, naming a copy/revision of the form in which the button was clicked. I think take the user defined value and store it in a string. I then use that string in an update statement to set the value of a field, but when I try to execute the SQL, I get a run time error stating the file could not be found.
My code is:
Everything shows the correct values when hovering over them, but I get that weird error then I try to run the SQL statement. I tried both versions shown to run it, as well as tried debug.print, but nothing.
Am I possibly using the input box incorrectly?
I am trying to use the input box to allow the user to set a value for a field. In this case, naming a copy/revision of the form in which the button was clicked. I think take the user defined value and store it in a string. I then use that string in an update statement to set the value of a field, but when I try to execute the SQL, I get a run time error stating the file could not be found.
My code is:
Code:
Dim strinput
Dim strsql
Call CreateRevisions
strinput = InputBox(prompt:="Name of revision")
If Not IsNull(strinput) Then
'DoCmd.SetWarnings False
strsql = " UPDATE tblJobDetails.RevisionName"
strsql = strsql & " SET tblJobDetails.RevisionName = '" & strinput & "'"
strsql = strsql & " WHERE (((tblJobDetails.JobID)=[Forms]![JobQuote]![JobID]));"
'DoCmd.RunSQL strsql
CurrentDb.Execute strsql
'docmd.setwarnings true
End If
Everything shows the correct values when hovering over them, but I get that weird error then I try to run the SQL statement. I tried both versions shown to run it, as well as tried debug.print, but nothing.
Am I possibly using the input box incorrectly?