The below code isn't working. Please help.

T

Tony L

'------------------------------------------------------------
' Upload_Barbara_Soltis_Timesheets
'
'------------------------------------------------------------
Function Upload_Barbara_Soltis_Timesheets()
On Error GoTo Upload_Barbara_Soltis_Timesheets_Err

DoCmd.SetWarnings False
DoCmd.OpenQuery "barbara_soltis_upload_all", acViewNormal, acEdit
DoCmd.OpenQuery "barbara_soltis_upload_all_to_vault", acViewNormal, acEdit
DoCmd.OpenQuery "barbara_soltis_delete_all"
DoCmd.Close acForm, "barbara's timesheet"

Upload_Barbara_Soltis_Timesheets_Exit:
Exit Function

Upload_Barbara_Soltis_Timesheets_Err:
MsgBox Error$
Resume Upload_Barbara_Soltis_Timesheets_Exit

End Function
 
T

Tony L

It runs as if it's running properly, but nothing happens. No error code or
anything.
 
D

Dorian

First try removing the 'SetWarnings' statement and see if you get any
feedback on the error.
If not, I suggest opening the 3 queries manually in turn from the query view
to see if they are functioning.
I don't understand why this code is a function since it returns no value.
Also, not a good idea to have a form with an embedded space and a quote
character in the name.
The 'Msgbox Error$' is a very old syntax, change it to 'Msgbox
Err.Description'

-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".
 
S

Stefan Hoffmann

hi Tony,

Tony said:
It runs as if it's running properly, but nothing happens. No error code or
anything.
Then it works. Great.
I would remove the line above while testing.
What do suspect to happen here (acEdit) ?
Can you describe your desired workflow?

btw, OpenQuery does normally open a query not execute it. For action
queries you need:

Option Compare Database
Option Explicit

Public Sub Upload_Barbara_Soltis_Timesheets()

On Local Error GoTo LocalError

Dim db As DAO.Database

Set db = CurrentDb

db.Execute "barbara_soltis_delete_all", dbFailOnError
DoCmd.Close acForm, "barbara's timesheet"

Set db = Nothing
Exit Sub

LocalError:
MsgBox Err.Description
Set db = Nothing

End Sub


mfG
--> stefan <--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top