473,327 Members | 2,094 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Problem: For Loop to add records to recordset?

Hi,

I'm using Access 2003 and VB 6.3 to set exams and track progress. I've
created a command button on a form (continuous forms) which runs the
code below in it's On_Click event. It adds 8 new records if the
RecordSet is empty. It also assigns a value to each (Me.txtModuleID)
control and it works just fine.

Private Sub cmdSetExams_Click()
Dim i As Long

With Me.Recordset
If .EOF = True And .BOF = True Then
For i = 1 To 8
Me.Recordset.AddNew
Me.txtModuleID = i
Next
End If
End With
End Sub

I would like the form to automatically add a new record whenever a
resit is required.

Is there any way to add code to this button which will search each
record in the RecordSet, when it is not empty, find out if the record's
control (Me.chbxResit) is True and if so, add a new record and copy the
Me.txtModuleID value into the new record.

N.B. An added complication is that up to three resits are allowed for
each module.

Terry

Nov 17 '05 #1
1 1570
hi

this is a C# NG, not a VB 6 one, post this question in the VB6 NG
cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
<tc*****@merseymail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
Hi,

I'm using Access 2003 and VB 6.3 to set exams and track progress. I've
created a command button on a form (continuous forms) which runs the
code below in it's On_Click event. It adds 8 new records if the
RecordSet is empty. It also assigns a value to each (Me.txtModuleID)
control and it works just fine.

Private Sub cmdSetExams_Click()
Dim i As Long

With Me.Recordset
If .EOF = True And .BOF = True Then
For i = 1 To 8
Me.Recordset.AddNew
Me.txtModuleID = i
Next
End If
End With
End Sub

I would like the form to automatically add a new record whenever a
resit is required.

Is there any way to add code to this button which will search each
record in the RecordSet, when it is not empty, find out if the record's
control (Me.chbxResit) is True and if so, add a new record and copy the
Me.txtModuleID value into the new record.

N.B. An added complication is that up to three resits are allowed for
each module.

Terry

Nov 17 '05 #2

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

Similar topics

7
by: Navin | last post by:
hi, i am using the follwoing code to write a recordset to a csv file 'fcreateFile -file system object Do While Not oRs.EOF fcreateFile.Write(oRs.GetString(,1000,",",vbcrlf,"")) 'Write Login...
2
by: CharitiesOnline | last post by:
Hello, I have set this script up to add paging to a search results page. Which on the first page works fine. I calculates how many pages there should be depending on the number of results returned...
4
by: JP SIngh | last post by:
Thanks to Manohar for writing the basic code for displaying the managers and the employees in a tree like structure. I have adapted the code below but it gives me an error "exception occcured"...
5
by: !TG | last post by:
I currently use Do while loop, but I'd rather use a For Loop though I have never gotten the hang of them. Would some one please be so kind as to show me how to loop through a recordset.
9
by: deko | last post by:
When doing a mail merge with Word, I can't seem to get the below (abbreviated) routine to iterate strBookmark01 -- it just uses the first name in the recordset for all 10 (or whatever) documents......
1
by: David | last post by:
Hi, I have a continuous form based on a query. Lets say the form displays 6 records. I also have a button against each record which sets a field to Y or N for each record. I am trying to...
8
by: Dave Hagerich | last post by:
I'm using a DataGrid with a DataSet and I'm trying to filter the data being displayed, using the following code as a test: DataView theView = new DataView(theDataSet.Tables); theView.RowFilter =...
52
by: MP | last post by:
Hi trying to begin to learn database using vb6, ado/adox, mdb format, sql (not using access...just mdb format via ado) i need to group the values of multiple fields - get their possible...
22
by: MP | last post by:
vb6,ado,mdb,win2k i pass the sql string to the .Execute method on the open connection to Table_Name(const) db table fwiw (the connection opened via class wrapper:) msConnString = "Data Source="...
2
kcdoell
by: kcdoell | last post by:
Hello I have a code where I want to delete the records that are found in my DAO recordset. I took a stab at this for the first time and got it to work but it is only delete one record at a time. If...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.