See how this goes, Steve:
Function LoopFields()
Dim rs As DAO.Recordset
Dim strFields() As String
Dim i As Integer
Set rs = DBEngine(0)(0).OpenRecordset("MyTable", dbOpenDynaset)
ReDim strFields(rs.Fields.Count - 1)
For i = 0 To rs.Fields.Count - 1
strFields(i) = rs.Fields(i).Name
Next
rs.Close
Set rs = Nothing
For i = LBound(strFields) To UBound(strFields)
Debug.Print strFields(i)
Next
End Function
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users -
http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"Steve" <(E-Mail Removed)> wrote in message
news:405365E4-52FC-4731-8363-(E-Mail Removed)...
> Hi
> my question is this
>
> how can I loop through a Known record ( same record every time) and store
> each field into a variable
> Somthing like this - (dont use this as it dont work)
> Dim Deft(i) as variant
> For i = 1 To 20
> Deft(i) = DLookup(Fields(i), "tblSetupLocal", "[SID]=1")
> Next i
>
> So I can manipulate the variables and then send each variable value back
> to
> the correct field in the rocord the same way. it would be very helpfull if
> I
> could do this.
>
> Steve - From a land down under
>