Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form Refresh issue

Status
Not open for further replies.

Pack10

Programmer
Feb 3, 2010
495
US
I have a routine that reads in emails from a group mailbox. Essentially it deletes the table, then adds the records and it runs every 5 minutes and displays on a split form. Sometimes
after it runs there are no records visible so the user has to close the form and re-open it to see the records. Most of the time, it refreshes fine.

I must be doing something wrong!



Heres the code

‘ delete current emails
DoCmd.OpenQuery “Delete_From_Mailbox”

For Each objMessage In DDQInbox

With rst
.AddNew

.Fields("Task_Subject") = objMessage.Subject
.Fields("Body") = objMessage.Body
.Fields("Task_From") = objMessage.SenderName
.Fields("Task_Received") = objMessage.ReceivedTime
.Fields("Status") = "Unassigned"
rst.Update

End With

StatusBar ("Working on Mail item dated: " & objMessage.ReceivedTime)

Next

Forms!Supervisor_Queue.Form.Requery

rst.Close
 
I had a problem a while back like that, the fix was to add the code

Begintrans
CommitTrans
Forms!Supervisor_Queue.Form.Requery

The begin and commit trans force the server to flush everything to disk, and for some reason, it fixed it. I never did figure out what actually caused it, I wrote it off as being some network issue.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top