Choosing one record at a time (1 Viewer)

jgier

Registered User.
Local time
Yesterday, 22:36
Joined
Mar 19, 2012
Messages
21
Hello,

I have currently taken over a large upload process developed by the previous DB developer and am still learning the ADVANCED aspects of coding. I am trying to pull data from a Mass Input table and cycle each record one at a time through a set of coding to string the fields together. At this point I have it where the code pulls all data from this table all at once. I would like it where it pulls 1 record, flows through the process, than loops back to do the following record. Anyone have any suggestions, any help would be very much appreciated. Thanks in advance.

This is what I have so far:

rsTemp.Open _
Source:="Select * " & _
" From MASS_TEMP_INPUT;", _
ActiveConnection:=CurrentProject.Connection
With rsTemp
Do While Not .EOF

If Not IsNull(rsTemp) Then
strQuote = ""

End If

Set rsTemp = New ADODB.Recordset
rsTemp.Open _
Source:="INSERT INTO TEMP_INPUT" & _
" SELECT * " & _
" FROM MASS_TEMP_INPUT;", _
ActiveConnection:=CurrentProject.Connection

DoCmd.OpenQuery "DEL_TEMP_02", acViewNormal
DoCmd.OpenQuery "DEL_TEMP_03", acViewNormal
DoCmd.OpenQuery "DEL_TEMP_04", acViewNormal
DoCmd.OpenQuery "QRY_01_LIC", acViewNormal
DoCmd.OpenQuery "QRY_02_LOA", acViewNormal
DoCmd.OpenQuery "QRY_03_APT", acViewNormal

Call CreateLicenseString
Call CreateApptOnlyString
Call PostRecord

.MoveNext
Loop
End With
End If
 

PNGBill

Win10 Office Pro 2016
Local time
Today, 17:36
Joined
Jul 15, 2008
Messages
2,271
Best to Post Code within the Code Posting facility provided - Hash Symbols.
Code:
Like this
You appear to be using the same recordset twice.
rsTemp is opened and while you are looping through same you have created a new recordset named rsTemp

Use a new name for the 2nd recordset.

You will need to close this 2nd recordset before looping and creating it again when on the next record of rsTemp.

Or, I have misread what you are doing.
 

smig

Registered User.
Local time
Today, 08:36
Joined
Nov 25, 2009
Messages
2,209
I can't see how running 6 querys will give you this: string the fields together

If what you want is to string the fields together use this code
Code:
dim StrFields as string

with rs
StrFields = rs.Fields(Field1)
StrFields = StrFields & rs.Fields(Field2)
StrFields = StrFields & rs.Fields(Field3)
StrFields = StrFields & rs.Fields(Field4)
StrFields = StrFields & rs.Fields(Field5)
....
 

Users who are viewing this thread

Top Bottom