Code Event Criteria

T

tighe

All,

how can, with the code below, have the f![Location] = Filename line to only
run if everything else occured?

Function SaveAppItem()
Set f = Screen.ActiveForm

surl = f![Hyperlink]
Filename = "\\Bcp\bcp\cmcc\cmcdb\20080922_CMCDB2\Documents\CE\Appendix\" &
f![UpdateNum] & ".pdf"

'With CreateObject("Wscript.Shell")
'Shell ("explorer.exe Filename")
Sleep (3000)
Dim oIExplorer: Set oIExplorer = CreateObject("InternetExplorer.Application")
oIExplorer.Navigate surl
oIExplorer.Visible = True
Sleep (3000)
Do: Loop Until oIExplorer.ReadyState = READYSTATE_COMPLETE
Sleep (2000)
'AppActivate ("InternetExplorer.Application")
'WshShell.AppActivate ("InternetExplorer.Application")

Sendkeys "+^{s}", True
Sleep (2000)
Sendkeys (Filename), True
Sleep (2000)
Sendkeys "{Enter}", True
Sleep (3000)

oIExplorer.Quit
f![Location] = Filename ' this event as long as everything occured
DoCmd.RunCommand (acCmdSaveRecord)

End Function
 
P

Paolo

Hi tighe,
I think you can try inserting a doevents commands before the f![Location] =
Filename line so

....all your function
Sleep (2000)
Sendkeys "{Enter}", True
Sleep (3000)

oIExplorer.Quit
doevents
f![Location] = Filename ' this event as long as everything occured
DoCmd.RunCommand (acCmdSaveRecord)

End Function

HTH Paolo
 
T

tighe

paolo,

thank you. i also decided to check the file that is suppoosed to be created
and have a msg box depending on results.

Paolo said:
Hi tighe,
I think you can try inserting a doevents commands before the f![Location] =
Filename line so

...all your function
Sleep (2000)
Sendkeys "{Enter}", True
Sleep (3000)

oIExplorer.Quit
doevents
f![Location] = Filename ' this event as long as everything occured
DoCmd.RunCommand (acCmdSaveRecord)

End Function

HTH Paolo

tighe said:
All,

how can, with the code below, have the f![Location] = Filename line to only
run if everything else occured?

Function SaveAppItem()
Set f = Screen.ActiveForm

surl = f![Hyperlink]
Filename = "\\Bcp\bcp\cmcc\cmcdb\20080922_CMCDB2\Documents\CE\Appendix\" &
f![UpdateNum] & ".pdf"

'With CreateObject("Wscript.Shell")
'Shell ("explorer.exe Filename")
Sleep (3000)
Dim oIExplorer: Set oIExplorer = CreateObject("InternetExplorer.Application")
oIExplorer.Navigate surl
oIExplorer.Visible = True
Sleep (3000)
Do: Loop Until oIExplorer.ReadyState = READYSTATE_COMPLETE
Sleep (2000)
'AppActivate ("InternetExplorer.Application")
'WshShell.AppActivate ("InternetExplorer.Application")

Sendkeys "+^{s}", True
Sleep (2000)
Sendkeys (Filename), True
Sleep (2000)
Sendkeys "{Enter}", True
Sleep (3000)

oIExplorer.Quit
f![Location] = Filename ' this event as long as everything occured
DoCmd.RunCommand (acCmdSaveRecord)

End Function
 

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