By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,617 Members | 1,172 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,617 IT Pros & Developers. It's quick & easy.

A2K tables and VB: delay to update and/or refresh ?

P: n/a
Hi All,

I am getting crazy....
This code work fine in step by step but at execution time, it looks like a
delay to refresh the A2K table from VB is resulting in some records being
treated more than once.

What is wrong ?
How can I "flush" data in the A2K tables?
Thanks for helping,
Bernard
Private Sub Timer3_Timer()
Timer3.Interval = 0
Dim erlop As Integer, nbrecs As Integer, x As Integer
erlop = 0
Comm1.OutBufferCount = 0
Comm1.InBufferCount = 0
Image1.Visible = Not Image1.Visible
If Comm1.PortOpen = True Then
If Not Data2.Recordset.EOF Then
Data2.Recordset.MoveFirst
nbrecs = Data2.Recordset.RecordCount
While Not Data2.Recordset.EOF
If Data2.Recordset("Sent") = False Then
okout = ""
Comm1.OutBufferCount = 0
Comm1.InBufferCount = 0
Comm1.Output = "at+cmgs=" & Chr(34) &
Data2.Recordset("tonum") & Chr(34) & vbCr & Data2.Recordset("texte") &
Chr(26)
While InStr(1, okout, "OK") = 0 And InStr(1, okout, "ERROR")
= 0
erlop = erlop + 1
okout = okout & Comm1.Input
dummy = DoEvents()
If erlop > 50 Then
erlop = 0
Comm1.OutBufferCount = 0
Timer3.Interval = 1000
Exit Sub
End If
Wend
If InStr(1, okout, "OK") <> 0 Then
Comm1.OutBufferCount = 0
Data2.Recordset.Edit
Data2.Recordset("Sent") = True
Data2.Recordset.Update
Data2.Recordset.Delete
wait (3)
Data2.Refresh
End If
If InStr(1, okout, "ERROR") <> 0 Then
Comm1.OutBufferCount = 0
End If
Else
Data2.Recordset.Delete
Data2.Refresh
End If
If Not Data2.Recordset.EOF Then
Data2.Recordset.MoveNext
End If
Wend
End If
End If
Timer3.Interval = 1000
End Sub
Jul 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.