Hi First time i am posting a question so here goes...
I have created a bit of VBA for pupils where the aim is: input line of text from file;parse the input line and extract values; using the AddNew, populate the respetive fields in the table. General outline is:
[code=vb]Set cncurrent = CurrentProject. Connection
Set rsDiag = New ADODB.Recordset
'Open the database table
strsql = "Select * from tblEquipment"
rsDiag.Open strsql, cncurrent, adOpenDynamic, adLockOptimisti c
.....
Open FileName For Input As #1
....
Do While Not EOF(1)
....
rsDiag.AddNew
rsDiag!NumberPl ate = NumberPlate
rsDiag!TypeOfEq uipment = TypeOfEquipment
Loop
....[/code]
Pupils are updating to suit their application. Some pupils have had no problems however, some have. The problem occurs second time through the loop where control is transfered back to the form (where the above code is linked with a button) when the rsDiag.AddNew statement executes. No run time errors are generated, just a very graceful return to the calling form. It is as if rsDiag.AddNew is seen as End Sub but only the second time through the loop.
Totally baffled and have some very frusterated pupils, who, in order to achieve came to my Saturday session today!!
Please help. By the way, how will I know when their is a response to this post? Certainly don't want to miss it. If you do reply can you please advice me by email so I know to look ********
Thanks in advance
I have created a bit of VBA for pupils where the aim is: input line of text from file;parse the input line and extract values; using the AddNew, populate the respetive fields in the table. General outline is:
[code=vb]Set cncurrent = CurrentProject. Connection
Set rsDiag = New ADODB.Recordset
'Open the database table
strsql = "Select * from tblEquipment"
rsDiag.Open strsql, cncurrent, adOpenDynamic, adLockOptimisti c
.....
Open FileName For Input As #1
....
Do While Not EOF(1)
....
rsDiag.AddNew
rsDiag!NumberPl ate = NumberPlate
rsDiag!TypeOfEq uipment = TypeOfEquipment
Loop
....[/code]
Pupils are updating to suit their application. Some pupils have had no problems however, some have. The problem occurs second time through the loop where control is transfered back to the form (where the above code is linked with a button) when the rsDiag.AddNew statement executes. No run time errors are generated, just a very graceful return to the calling form. It is as if rsDiag.AddNew is seen as End Sub but only the second time through the loop.
Totally baffled and have some very frusterated pupils, who, in order to achieve came to my Saturday session today!!
Please help. By the way, how will I know when their is a response to this post? Certainly don't want to miss it. If you do reply can you please advice me by email so I know to look ********
Thanks in advance
Comment