Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 548
  • Last Modified:

Runtime error '3078' even though SQL string appears correct

Experts,

Could someone shed some light on this little problem. Below is the VBA code used to update the delivery date fields for a customer in a table called tbl_temp_orders. It is executed after the date within the tbx_clients_nextcall  textbox is changed on a form.

I have checked the resulting strSQL using MsgBox and all seems perfect BUT i get the following error:  

Runtime error '3078'
The Microsoft Jet Database Engine cannot find the input table or query ". Make sure it exists and that its mane is spelled correctly.

Thanks in Advance

Jason




Sub UpdateDeldate_TempOrdersTable()
Dim strSQL As String
 
'Create SQL string to update the deldate in tbl_temp_orders when the delivery date is changed
strSQL = "UPDATE tbl_temp_orderentry SET tbl_temp_orderentry.deldate = #" & Format$(Me.tbx_clients_nextcall, "mm\/dd\/yyyy") & "# WHERE (tbl_temp_orderentry.code) = '" & Trim(Me!code) & "';"

'Execute strSQL
DBEngine(0)(0).Execute strSQL1, dbFailOnError

End Sub
0
jason_pleaner
Asked:
jason_pleaner
4 Solutions
 
ADSaundersCommented:
Hi jason_pleaner,

???
tbl_temp_orders (in your description)
UPDATE tbl_temp_orderentry .... (in your SQL)
???

Regards .. Alan
0
 
Mike EghtebasDatabase and Application DeveloperCommented:
Try:

strSQL = "UPDATE tbl_temp_orderentry SET deldate = #" & Format$(Me!tbx_clients_nextcall, "mm/dd/yyyy") & "# WHERE code = '" & Trim(Me!code) & "'"

Field code is string, right?

Later on you can change to mm\/dd\/yyyy if necessary.

Mike
0
 
NatchiketCommented:
Try putting a breakpoint in after strSQL has been formulated, copy the contents of strSQL from the immediate window and paste it into a query, and see if it runs from there.  You may get a more informative error description
0
 
Mike EghtebasDatabase and Application DeveloperCommented:
Btw, you don't need $ in:

Format(Me!tbx_clients_nextcall, "mm/dd/yyyy")
0
 
jason_pleanerAuthor Commented:
Thanks all,

At the end of the day I figured out another way to do it.

Jason
0

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now