Hello out there-
I need to populate a table with a range of numbers, the following code works great except when the numbers have a leading 0:
Private Sub cmdRunCode_Click()
Dim intStart As Long
Dim IntEnd As Long
Dim intReqNum As Long
Dim rst As Recordset
Set rst = CurrentDb.OpenRecordset("Select*From tbl_Test")
intStart = Me.txtStartNum
IntEnd = Me.txtEndNum
intReqNum = intStart
Do While intReqNum <= IntEnd
rst.AddNew
rst!ReqNum = intReqNum
rst.Update
intReqNum = intReqNum + 1
Loop
rst.Close
Set rst = Nothing
End Sub
I have tried changing the data type, of course in the table I have as text, but the preceding zeros are still being stripped out. Can anybody help me on this? (Many times I have been "stuck" on an Access issue and I always seem to get it resolved by posting on this site!)
I need to populate a table with a range of numbers, the following code works great except when the numbers have a leading 0:
Private Sub cmdRunCode_Click()
Dim intStart As Long
Dim IntEnd As Long
Dim intReqNum As Long
Dim rst As Recordset
Set rst = CurrentDb.OpenRecordset("Select*From tbl_Test")
intStart = Me.txtStartNum
IntEnd = Me.txtEndNum
intReqNum = intStart
Do While intReqNum <= IntEnd
rst.AddNew
rst!ReqNum = intReqNum
rst.Update
intReqNum = intReqNum + 1
Loop
rst.Close
Set rst = Nothing
End Sub
I have tried changing the data type, of course in the table I have as text, but the preceding zeros are still being stripped out. Can anybody help me on this? (Many times I have been "stuck" on an Access issue and I always seem to get it resolved by posting on this site!)