yballan
asked on
Run-time error '3188'
Dear Experts,
I am having a difficulty debugging my code, which first seemed to be a timing issue.
I have a database with a field that contains large memo field which is to be viewed by previewWin, which is an OLE Class (Microsoft Web Browser)
In order to do that, first I write this memo field out to a local html file by the following code.
Then previewed with this:
The preview works fine, but the error occurs when I try to go back to one of my forms in following code:
The error is "Run-time error '3188'
could not update; currently locked by another session on this machine"
As you can see, I tried to put some pauses in case there was a timing issue, and played around with the length of the pause, but it does not seem to make any difference.
Now I am starting to suspect that my writing to html file has something to do with it because the error only happens when I update this memo field, preview, then try to go back to my form again.
I am totally stumped, please advise.
I am having a difficulty debugging my code, which first seemed to be a timing issue.
I have a database with a field that contains large memo field which is to be viewed by previewWin, which is an OLE Class (Microsoft Web Browser)
In order to do that, first I write this memo field out to a local html file by the following code.
Private Sub Command88_Click()
memoBlob = Me.Description
Open "c:\ECEditor\prvWin.html" For Output As #1
Print #1, memoBlob
Close #1
PauseTime = 0
start = Timer
Do While Timer < start + PauseTime
DoEvents
Loop
DoCmd.OpenForm "previewWin", acNormal
End Sub
memoBlob = Me.Description
Open "c:\ECEditor\prvWin.html" For Output As #1
Print #1, memoBlob
Close #1
PauseTime = 0
start = Timer
Do While Timer < start + PauseTime
DoEvents
Loop
DoCmd.OpenForm "previewWin", acNormal
End Sub
Then previewed with this:
Private Sub WebBrowser3_Enter()
Me.WebBrowser3.Navigate ("c:\ECEditor\prvWin.html" )
End Sub
Me.WebBrowser3.Navigate ("c:\ECEditor\prvWin.html"
End Sub
The preview works fine, but the error occurs when I try to go back to one of my forms in following code:
Private Sub Form_Activate()
Set dbsDatabase = CurrentDb
CurrID = DLookup("ShouhinID", "RecordOffset", "[ID] = 1")
PauseMe (0.4) ' otherwise we get record_locked_error
StrCond = "ShouhinID = " & CurrID
PauseMe (0.4)
Forms![NewProduct_desc].Fi lterOn = True
PauseMe (0.4)
Forms![NewProduct_desc].Fi lter = StrCond <--- here is where it stops.
End Sub
Set dbsDatabase = CurrentDb
CurrID = DLookup("ShouhinID", "RecordOffset", "[ID] = 1")
PauseMe (0.4) ' otherwise we get record_locked_error
StrCond = "ShouhinID = " & CurrID
PauseMe (0.4)
Forms![NewProduct_desc].Fi
PauseMe (0.4)
Forms![NewProduct_desc].Fi
End Sub
The error is "Run-time error '3188'
could not update; currently locked by another session on this machine"
As you can see, I tried to put some pauses in case there was a timing issue, and played around with the length of the pause, but it does not seem to make any difference.
Now I am starting to suspect that my writing to html file has something to do with it because the error only happens when I update this memo field, preview, then try to go back to my form again.
I am totally stumped, please advise.
ASKER
Dear Scott C,
Thank you for your prompt reply, I tried it, but still the same error. :(
Thank you for your prompt reply, I tried it, but still the same error. :(
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Dear Scott C.
After reading your comment, I did delete Form Activate event, and instead, used Form Current event, and the error went away. Thank you so much!!!!!!
After reading your comment, I did delete Form Activate event, and instead, used Form Current event, and the error went away. Thank you so much!!!!!!
I'm glad it worked out for you.
-s
-s
Dim f as long
f = freefile
Open "c:\ECEditor\prvWin.html" For Output As #f
Print #f, your stuff
Close f
Scott C