I have been trying to get a program that i have been working on to load a date but everytime i do this i keep getting an OVERFLOW message.
i have tried numerous things but it does not seem to work is there anybody who can help me with this problem if you could i would be very greatful.
this is the code that i have wrote if somebody can shed some light as to what the problem is i would be most greatful
'------------------------------------------
Private Sub Form_Load()
CurSysDate = Format(dd - mmmm - yy)
CurSysDate = Date
' Read the sequential file
Dim intCtr As Integer ' Loop counter
Dim intVal As Integer ' Read value
Dim intMsg As Integer ' MsgBox()
Dim Vehnum As Integer
'FreeFile
Open "C:\Documents and Settings\Barclay Classics\My Documents\Projects\Vb projects\Vehicle Reminders\CRsys.amt" For Input As #1
For intCtr = 1 To 1
Input #1, intVal
' Display the results in the Immediate window
intMsg = MsgBox("Retrieved a " & intVal & " from Print.txt")
Next intCtr
Close #1
Open "C:\Documents and Settings\Barclay Classics\My Documents\Projects\Vb projects\Vehicle Reminders\Vehicle Database\database.cdb" For Input As #1
For intCtr = 1 To intVal
Input #1, filesave(intCtr)
' Display the results in the Immediate window
intMsg = MsgBox("Retrieved a " & filesave(intCtr) & " from Print.txt")
Next intCtr
Close #1
For Vehnum = 1 To 1
FileOpen = filesave(Vehnum)
Open "C:\Documents and Settings\Barclay Classics\My Documents\Projects\Vb projects\Vehicle Reminders\Vehicles in Active reminder list\" & FileOpen & ".CSD" For Input As #1
'datal = Format(MOT_DDate(Vehnum), "ddmmyy")
'------- Below is the problem area ---------
For loader = 1 To 9
If loader = 1 Then Input #1, VehicleType(Vehnum) 'fine
If loader = 2 Then Input #1, Registration(Vehnum) 'fine
If loader = 3 Then Input #1, Yearstring(Vehnum) 'fine
If loader = 4 Then Input #1, Descriptive(Vehnum) 'fine
'from here onwards the error appears
If loader = 5 Then Input #1, datal '<--- Overflow
If loader = 5 Then MOT_DDate(Vehnum) = datal
If loader = 6 Then Input #1, datal
If loader = 6 Then MOT_SDate(Vehnum) = datal
If loader = 7 Then Input #1, retrieved
If loader = 7 Then TAX_DDate(Vehnum) = datal
If loader = 8 Then Input #1, datal
If loader = 8 Then TAX_SDate(Vehnum) = datal
If loader = 9 Then Input #1, datal
If loader = 9 Then SORN_SDate(Vehnum) = datal
' Display the results in the Immediate window
intMsg = MsgBox("Retrieved " & retrieved & " information successfully")
Next loader
Close #1
Next Vehnum
End Sub
'--------------------------------------------------------
I have Defined Datal as a date in a global.bas
below is the Global.bas source code as in the top i will highlight the various areas
'--------------- Code starts below ---------------------
Global MotDueDate As Date
Global MotDate As Date
Global MotExpired As Boolean
Global TaxDueDate As Date
Global TaxDate As Date
Global TaxExpired As Boolean
Global SafeTCode As Long
Global VeEs As Boolean
Global Earlywarning As Boolean
Global EwEs As Boolean
Global DnES As Boolean
Global DCheck As Boolean
Global CurSysDate As Date
Global activatedte As Date
Global SornDate As Date
Global messages
Public DBase
' All of the below code defines arrays to have a databse
' style interface
Public VehicleDetails(9999)
Public VehicleType(9999) As String
Public make(9999)
Public Registration(9999) As String
Public Descriptive(9999) As String
Public Yearstring(9999)
Global retrieved
Public MOT_DDate(9999) As Date '<- define a database array
Public MOT_SDate(9999) As Date '<- Database like array
Public TAX_DDate(9999) As Date '<-Database array
Public TAX_SDate(9999) As Date '<- Database like array
Public SORN_SDate(9999) As Date '<- Database like array
Public filesave(9999) As String '<----- the save file Array
Global FileOpen '<-------- the file open variable
Global datal As Date '<-------- defined this as a date
Public OnlyOneClick As Boolean
'----------------------------------------------------------
and below is the files in which it loads and what data they contain
Austin 1100 (Cream) - GBX 868E.CSD
start of file
-----------------------
Austin 1100 (Cream)
GBX 868E
1967
Very Good interior
01:01:83
01:01:83
01:01:83
01:01:83
01:01:83
--------------------------
and the database file contains the below
database.CDB
start of file
---------------------------
"Austin 1100 (Cream) - GBX 868E"
---------------------------
i have tried numerous things but it does not seem to work is there anybody who can help me with this problem if you could i would be very greatful.
this is the code that i have wrote if somebody can shed some light as to what the problem is i would be most greatful
'------------------------------------------
Private Sub Form_Load()
CurSysDate = Format(dd - mmmm - yy)
CurSysDate = Date
' Read the sequential file
Dim intCtr As Integer ' Loop counter
Dim intVal As Integer ' Read value
Dim intMsg As Integer ' MsgBox()
Dim Vehnum As Integer
'FreeFile
Open "C:\Documents and Settings\Barclay Classics\My Documents\Projects\Vb projects\Vehicle Reminders\CRsys.amt" For Input As #1
For intCtr = 1 To 1
Input #1, intVal
' Display the results in the Immediate window
intMsg = MsgBox("Retrieved a " & intVal & " from Print.txt")
Next intCtr
Close #1
Open "C:\Documents and Settings\Barclay Classics\My Documents\Projects\Vb projects\Vehicle Reminders\Vehicle Database\database.cdb" For Input As #1
For intCtr = 1 To intVal
Input #1, filesave(intCtr)
' Display the results in the Immediate window
intMsg = MsgBox("Retrieved a " & filesave(intCtr) & " from Print.txt")
Next intCtr
Close #1
For Vehnum = 1 To 1
FileOpen = filesave(Vehnum)
Open "C:\Documents and Settings\Barclay Classics\My Documents\Projects\Vb projects\Vehicle Reminders\Vehicles in Active reminder list\" & FileOpen & ".CSD" For Input As #1
'datal = Format(MOT_DDate(Vehnum), "ddmmyy")
'------- Below is the problem area ---------
For loader = 1 To 9
If loader = 1 Then Input #1, VehicleType(Vehnum) 'fine
If loader = 2 Then Input #1, Registration(Vehnum) 'fine
If loader = 3 Then Input #1, Yearstring(Vehnum) 'fine
If loader = 4 Then Input #1, Descriptive(Vehnum) 'fine
'from here onwards the error appears
If loader = 5 Then Input #1, datal '<--- Overflow
If loader = 5 Then MOT_DDate(Vehnum) = datal
If loader = 6 Then Input #1, datal
If loader = 6 Then MOT_SDate(Vehnum) = datal
If loader = 7 Then Input #1, retrieved
If loader = 7 Then TAX_DDate(Vehnum) = datal
If loader = 8 Then Input #1, datal
If loader = 8 Then TAX_SDate(Vehnum) = datal
If loader = 9 Then Input #1, datal
If loader = 9 Then SORN_SDate(Vehnum) = datal
' Display the results in the Immediate window
intMsg = MsgBox("Retrieved " & retrieved & " information successfully")
Next loader
Close #1
Next Vehnum
End Sub
'--------------------------------------------------------
I have Defined Datal as a date in a global.bas
below is the Global.bas source code as in the top i will highlight the various areas
'--------------- Code starts below ---------------------
Global MotDueDate As Date
Global MotDate As Date
Global MotExpired As Boolean
Global TaxDueDate As Date
Global TaxDate As Date
Global TaxExpired As Boolean
Global SafeTCode As Long
Global VeEs As Boolean
Global Earlywarning As Boolean
Global EwEs As Boolean
Global DnES As Boolean
Global DCheck As Boolean
Global CurSysDate As Date
Global activatedte As Date
Global SornDate As Date
Global messages
Public DBase
' All of the below code defines arrays to have a databse
' style interface
Public VehicleDetails(9999)
Public VehicleType(9999) As String
Public make(9999)
Public Registration(9999) As String
Public Descriptive(9999) As String
Public Yearstring(9999)
Global retrieved
Public MOT_DDate(9999) As Date '<- define a database array
Public MOT_SDate(9999) As Date '<- Database like array
Public TAX_DDate(9999) As Date '<-Database array
Public TAX_SDate(9999) As Date '<- Database like array
Public SORN_SDate(9999) As Date '<- Database like array
Public filesave(9999) As String '<----- the save file Array
Global FileOpen '<-------- the file open variable
Global datal As Date '<-------- defined this as a date
Public OnlyOneClick As Boolean
'----------------------------------------------------------
and below is the files in which it loads and what data they contain
Austin 1100 (Cream) - GBX 868E.CSD
start of file
-----------------------
Austin 1100 (Cream)
GBX 868E
1967
Very Good interior
01:01:83
01:01:83
01:01:83
01:01:83
01:01:83
--------------------------
and the database file contains the below
database.CDB
start of file
---------------------------
"Austin 1100 (Cream) - GBX 868E"
---------------------------