Loop Function

rfreeman

New member
Local time
Yesterday, 18:39
Joined
Oct 4, 2004
Messages
8
I am fairly new to coding. I have the following snippet of code adapted from another module. I need to edit each hyperlink field in the underlying query with a new path. Here's what I have so far, I just don't know how to make it loop through the entire recordset.

Dim dbCurrent As Database
Dim lngReturn As Long
Dim strCurFileName As String, strBaseFileLocation As String
Dim qdfContactInfo As QueryDef, rsContactInfo As Recordset

Set qdfContactInfo = dbCurrent.QueryDefs("qRenamePDFLinks")
Set rsContactInfo = qdfContactInfo.OpenRecordset()

For Each ???????? In rsContactInfo

strBaseFileLocation = "\\SERVER\Data\LIMS PDF Reports\"
strCurFileName = strBaseFileLocation & rsContactInfo!CompanyName & " Order " & rsContactInfo!OrderID & ".pdf"

rsContactInfo.Edit
rsContactInfo("ReportPDF") = "View Report" & "#" & strCurFileName & "#"
rsContactInfo.Update

Next



Thanks for any help.
 
r,

This edits ALL records though ...

Code:
While Not rsContactInfo.EOF and Not rsContactInfo.BOF
   rsContactInfo.Edit
   rsContactInfo("ReportPDF") = "View Report" & "#" & strCurFileName & "#"
   rsContactInfo.Update
   rsContactInfo.MoveNext
   Wend

Wayne
 
Thanks for the reply. I'll give it a try. :)
 

Users who are viewing this thread

Back
Top Bottom