In the following code, during the For/Next loop, I'd like the Fields(2) data when entered to be entered as a number, rather than text which seems to be the default. I'm sure it's simple, I'm just brand new to Access VBA... thanks!
Code:
Sub AddToFlat()
Dim db As DAO.Database
Dim fldWide As DAO.Field
Dim fldFlat As DAO.Field
Dim rstWide As DAO.Recordset
Dim rstFlat As DAO.Recordset
Dim I As Long
Set db = CurrentDb
Set rstWide = db.OpenRecordset("Wide")
Set rstFlat = db.OpenRecordset("Flat")
rstWide.MoveFirst
While Not (rstWide.EOF)
With rstFlat
For I = 1 To rstWide.Fields.Count - 1
.AddNew
.Fields(0) = rstWide.Fields(0)
.Fields(1) = rstWide.Fields(I).Name
.Fields(2) = rstWide.Fields(I)
.Update
Next I
End With
rstWide.MoveNext
Wend
End Sub