Results 1 to 8 of 8

Thread: Error : Not a legal OleAut date.

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Apr 2012
    Posts
    24

    Error : Not a legal OleAut date.

    I get this error when i try to drag a record from a file;

    Code:
        Private Sub cboBookingID_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cboBookingID.Click
    
            Me.cboBookingID.Items.Clear()
            'output all records method 1
            NumberOfRecords = LOF(4) / Len(OneBooking)
            For Index = 1 To NumberOfRecords
                FileGet(4, OneBooking, Index)
                If OneBooking.Deleted = False Then
                    Me.cboBookingID.Items.Add(Index)
                End If
            Next Index
    
    
        End Sub
    The bit in bold is where the error crashes at. Any idea why it crashes, it because i used this code for like 5 other files and worked perfectly fine.

  2. #2
    Karen Payne MVP kareninstructor's Avatar
    Join Date
    Jun 2008
    Location
    Oregon
    Posts
    6,684

    Re: Error : Not a legal OleAut date.

    Quote Originally Posted by Barhuumi View Post
    I get this error when i try to drag a record from a file;

    Code:
        Private Sub cboBookingID_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cboBookingID.Click
    
            Me.cboBookingID.Items.Clear()
            'output all records method 1
            NumberOfRecords = LOF(4) / Len(OneBooking)
            For Index = 1 To NumberOfRecords
                FileGet(4, OneBooking, Index)
                If OneBooking.Deleted = False Then
                    Me.cboBookingID.Items.Add(Index)
                End If
            Next Index
    
    
        End Sub
    The bit in bold is where the error crashes at. Any idea why it crashes, it because i used this code for like 5 other files and worked perfectly fine.
    As with your other post, consider better explaining the problem and code. Seeing you are using obsolete methods and more likely than not have Option Strict Off all the more important you provide more details.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Apr 2012
    Posts
    24

    Re: Error : Not a legal OleAut date.

    Quote Originally Posted by kevininstructor View Post
    As with your other post, consider better explaining the problem and code. Seeing you are using obsolete methods and more likely than not have Option Strict Off all the more important you provide more details.
    Sorry, i thought it was pretty self explanatory, and didn't explain the code since i used it over 10 times in this project. I was asking what the error was or what it meant since i have never come across it before.. but sure i'll break down the code for you.

    Code:
            Me.cboBookingID.Items.Clear() 'Clears combo box.
            'output all records method 1
            NumberOfRecords = LOF(4) / Len(OneBooking)
            For Index = 1 To NumberOfRecords ' Loops thorough all records in file.
                FileGet(4, OneBooking, Index) 'gets record one by one.
                If OneBooking.Deleted = False Then 'Only finds records that isn't deleted.
                    Me.cboBookingID.Items.Add(Index) 'Then adds the record to the combo box.
                End If
            Next Index
    Now that worked for me a coupla times, but what i don't get is why it crashes all of a sudden, and what the error means.

  4. #4
    Karen Payne MVP kareninstructor's Avatar
    Join Date
    Jun 2008
    Location
    Oregon
    Posts
    6,684

    Re: Error : Not a legal OleAut date.

    Okay next question, I am not a VB6 programmer I have never used FileGet. So what does the file content look like, is it a structured text file or binary?

  5. #5
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: Error : Not a legal OleAut date.

    Quote Originally Posted by kevininstructor View Post
    Okay next question, I am not a VB6 programmer I have never used FileGet. So what does the file content look like, is it a structured text file or binary?
    It looks like he is attempting to enumerate several records in a binary file. Each record would be of type OneBooking. This was a pretty common way to store data in VB6 and Ad-hoc databases were made and read in this way in QuickBasic.

    The members would be layout in much the same manner as a sequential structure in memory with padding and alignment and so on.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  6. #6
    New Member
    Join Date
    Dec 2013
    Posts
    4

    Re: Error : Not a legal OleAut date.

    can I see OneBooking structure

  7. #7
    Addicted Member
    Join Date
    Jul 2017
    Location
    Exeter, UK
    Posts
    180

    Re: Error : Not a legal OleAut date.

    The error suggest that a date field in the OneBooking structure, is not compatible with the data being read in.

  8. #8
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: Error : Not a legal OleAut date.

    Quote Originally Posted by bmwpete View Post
    The error suggest that a date field in the OneBooking structure, is not compatible with the data being read in.
    This thread was made all the way back in 2012, 7 years ago.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width