473,466 Members | 1,413 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Strange, strange...

Hi All,
I posted this already today and I am really getting bananas with this issue:

Using Visual Basic 6.0, I am sending SMS. These SMS can be added to an
Access 2000 table by users on the network.
Everything works well when executing the code step by step (F8).
I can trace this in the Access table, that reacts exactly according to what
I was expecting.
But, but....
When running the code, it looks like the records in Access are not updated
quickly enough and, therefore, the SMS are sent more than once (up to 10
times for some).

Here is how I open the table in the Access MDB:

Dim Db2 As Database, Rs2 As Recordset
Set Db2 = Workspaces(0).OpenDatabase(Text10) ' Text10 contains the path
to the Access MDB
Set Rs2 = Db2.OpenRecordset("pendingsms")
Set Data2.Recordset = Rs2
Data2.Recordset.Index = "ID"

It opens correctly and I can view SMS added by net users, using a DbGrid
linked to Data2.
When I stop the timer3 procedure, I can see, in that same DbGrid, the
records marked as sent, after a few seconds.
I have a timer3 on the form, to scan the pending SMS and send them. Mainly,
I browse the Access table and for each record where the field "sent" is
FALSE, I sned the SMS and, if receiving an OK from the modem, I change the
"sent" field to TRUE.
ID tonum texte Sent
24904 +27824170857 test open/close/open Yes
Here is the code associated to Timer3

Private Sub Timer3_Timer()
Timer3.Interval = 0
Dim erlop As Integer, nbrecs As Integer, X As Integer
Dim Db2 As Database, Rs2 As Recordset
erlop = 0
Comm1.OutBufferCount = 0
Comm1.InBufferCount = 0
okout = ""
Image1.Visible = Not Image1.Visible
If imgNotConnected.Visible = False Then
imgConnected.Visible = Not imgConnected.Visible
End If
If Comm1.PortOpen = True Then
If Not Data2.Recordset.EOF Then
Data2.Recordset.MoveFirst
While Not Data2.Recordset.EOF
If Data2.Recordset("Sent") = False Then
okout = ""
erlop = 0
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 > 500 Then
erlop = 0
Comm1.OutBufferCount = 0
Timer3.Interval = 1000
Exit Sub
End If
Wend
Comm1.OutBufferCount = 0
If InStr(1, okout, "OK") <> 0 Then
Data2.Recordset.Edit
Data2.Recordset("Sent") = True
Data2.Recordset.Update
Data2.Recordset.Requery
Data2.Recordset.Delete
wait (3)
End If
Else
Data2.Recordset.Delete
Data2.Refresh
End If
Wend
End If
End If
Timer3.Interval = 1000
End Sub

What am I doing wrong?
If someone can help, I would be grateful.
Regards,
Bernard
Jul 17 '05 #1
3 3398
Hello HKSHK,

thanks for your reply.

I received an answer from Peter Russel, in the comp.databases.ms-access
newsgroups, telling me to have a look at

http://support.microsoft.com/default...b;en-us;248833

This is an interesting article about our common problem.

Hope it will help you too.

Regards,

Bernard

"HKSHK" <hk***@gmx.net> wrote in message
news:37**************************@posting.google.c om...
Hello Bernard,
Using Visual Basic 6.0, I am sending SMS. These SMS can be added to an
Access 2000 table by users on the network.
Everything works well when executing the code step by step (F8).
I can trace this in the Access table, that reacts exactly according to what I was expecting.
But, but....
When running the code, it looks like the records in Access are not updated quickly enough and, therefore, the SMS are sent more than once (up to 10
times for some).
I guess you encounter the same problem what I posted under " How can I
flush File Buffers for an Access database?"

(http://groups.google.com/groups?q=hk...e=UTF-8&oe=UTF
-8&scoring=d&selm=37464b94.0307212226.2eb4ccf%40pos ting.google.com&rnum=1).
I assume that it is Windows which has the database in its writing
cache. It might take up to 5 seconds before the changes are written
and can be requeried. Unfortunately I haven't found a solution for
this problem myself.

Kind Regards,

HKSHK

Jul 17 '05 #2
"Bernard André" <be****@bernan.net> wrote:
Hi All,
I posted this already today and I am really getting bananas with this issue:

Using Visual Basic 6.0, I am sending SMS. These SMS can be added to an
Access 2000 table by users on the network.
Everything works well when executing the code step by step (F8).
I can trace this in the Access table, that reacts exactly according to what
I was expecting.
But, but....
When running the code, it looks like the records in Access are not updated
quickly enough and, therefore, the SMS are sent more than once (up to 10
times for some).

[snip]

If you're using a version of Windows that provides control of write buffering,
turn it off.

If you have a LOT of RAM, put the database in a RAMdisk (fast - but fragile).

Find a better database/platform.

More about me: http://thelabwiz.home.mindspring.com/
VB3 source code: http://thelabwiz.home.mindspring.com/vbsource.html
VB6 source code: http://thelabwiz.home.mindspring.com/vb6source.html
VB6 - MySQL how to: http://thelabwiz.home.mindspring.com/mysql.html
My newest language - NSBasic for the Palm PDA: http://thelabwiz.home.mindspring.com/nsbsource.html
Drivers for Pablo graphics tablet and JamCam cameras: http://home.earthlink.net/~mwbt/
johnecarter atat mindspring dotdot com. Fix the obvious to reply by email.
Jul 17 '05 #3
Bernard,

Try using queries for "select" and "update" operations and you'll get
results always up-to-date.

Regards,
Alexey

Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Arthur | last post by:
I've come across some strange xml, that I need to deal with, it looks like this:- <root> <foo attr="1">Some random strange text. <bar attr="2">blar</bar> <bar attr="3">blar blar</bar> <bar...
2
by: Paul Drummond | last post by:
Hi all, I am developing software for Linux Redhat9 and I have noticed some very strange behaviour when throwing exceptions within a shared library. All our exceptions are derived from...
2
by: Olaf | last post by:
I have a frameset page witch contains the myFuc() function. The function is accessed from a page in one of the frames in the frameset. An example is shown below. <input...
7
by: M O J O | last post by:
Hi, I'm developing a asp.net application and ran into a strange css problem. I want all my links to have a dashed underline and when they are hovered, it must change to a solid line. Sounds...
25
by: Neil Ginsberg | last post by:
I have a strange situation with my Access 2000 database. I have code in the database which has worked fine for years, and now all of a sudden doesn't work fine on one or two of my client's...
0
by: unknown | last post by:
Hi, I am developing an online book store with shopping cart. My shopping cart is represented as a Xml server control and I am using an XSLT to render it at the client side. I am using an...
0
by: Kris Vanherck | last post by:
yesterday i started getting this strange error when i try to run my asp.net project: Compiler Error Message: CS0006: Metadata file 'c:\winnt\microsoft.net\framework\v1.1.4322\temporary asp.net...
11
by: Martin Joergensen | last post by:
Hi, I've encountered a really, *really*, REALLY strange error :-) I have a for-loop and after 8 runs I get strange results...... I mean: A really strange result.... I'm calculating...
20
by: SpreadTooThin | last post by:
I have a list and I need to do a custom sort on it... for example: a = #Although not necessarily in order def cmp(i,j): #to be defined in this thread. a.sort(cmp) print a
14
by: blumen | last post by:
Hi all, I'm a newbie in VB.Net Programming.. Hope that some of you can help me to solve this.. I'm working out to read,parse and save textfile into SQL Server. The textfile contains thousands...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.