Results 1 to 6 of 6
  1. #1
    Kipster1203 is offline Advanced Beginner
    Windows XP Access 2000
    Join Date
    May 2010
    Posts
    54

    My data is being cleared with zeros...

    I'm having a big issue... I have a table with document names in one column, document ID, and a couple other stuff as shown here



    The problem is that the Description column will randomly get filled with zeros!! And I then have to go back in the table and replace all the zeros with the document names again... I have no idea why/when this happens. I can't figure out what makes this happen, can anyone please help me? thanks

  2. #2
    Datagopherdan is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Dec 2008
    Posts
    220
    I know in previous version there were issues with the "Memo" type fields that would cause the data to be displayed with all different types of characters. Another cause could be that you have some underlying code that is triggering it to do that. I would take a look at both areas.

    Quote Originally Posted by Kipster1203 View Post
    I'm having a big issue... I have a table with document names in one column, document ID, and a couple other stuff as shown here



    The problem is that the Description column will randomly get filled with zeros!! And I then have to go back in the table and replace all the zeros with the document names again... I have no idea why/when this happens. I can't figure out what makes this happen, can anyone please help me? thanks

  3. #3
    Kipster1203 is offline Advanced Beginner
    Windows XP Access 2000
    Join Date
    May 2010
    Posts
    54
    Quote Originally Posted by Datagopherdan View Post
    I know in previous version there were issues with the "Memo" type fields that would cause the data to be displayed with all different types of characters. Another cause could be that you have some underlying code that is triggering it to do that. I would take a look at both areas.
    Ok, I found the underlying code that makes this happen but I don't know how to fix it (I didn't write it...), and don't wanna screw it up even more can anyone take a look? thank you.. This code is triggered when the user clicks the close button in one of the subforms.

    Code:
    Private Sub Form_Close()
        
        Dim db As DAO.Database
        Dim rs1 As DAO.Recordset
        Dim i As Integer
    
        Set db = CurrentDb()
        Set rs1 = db.OpenRecordset("Document Table", dbOpenDynaset)
        
        rs1.MoveFirst
        rs1.Edit
        rs1.Fields(1) = 0
        rs1.Update
    
        For i = 1 To rs1.RecordCount - 1
            rs1.MoveNext
            rs1.Edit
            rs1.Fields(1) = 0
            rs1.Update
        Next i
        
        rs1.Close
        
    End Sub

  4. #4
    Datagopherdan is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Dec 2008
    Posts
    220
    That's the problem. It's setting it that value when the form closes. If you don't want that to happen then just remove the code. If you're not 100% sure then what you can do if that's the only thing in the close event is just go to the form's properties, click on the "Events" tab and look for the "On Close". You'll see "[Event Procedure]" next to it. Just delete that. The code will still be there, so you can restore it by simply selecting "Event Procedure" from the drop-down but it will not be triggered anymore.

    Quote Originally Posted by Kipster1203 View Post
    Ok, I found the underlying code that makes this happen but I don't know how to fix it (I didn't write it...), and don't wanna screw it up even more can anyone take a look? thank you.. This code is triggered when the user clicks the close button in one of the subforms.

    Code:
    Private Sub Form_Close()
        
        Dim db As DAO.Database
        Dim rs1 As DAO.Recordset
        Dim i As Integer
    
        Set db = CurrentDb()
        Set rs1 = db.OpenRecordset("Document Table", dbOpenDynaset)
        
        rs1.MoveFirst
        rs1.Edit
        rs1.Fields(1) = 0
        rs1.Update
    
        For i = 1 To rs1.RecordCount - 1
            rs1.MoveNext
            rs1.Edit
            rs1.Fields(1) = 0
            rs1.Update
        Next i
        
        rs1.Close
        
    End Sub

  5. #5
    Kipster1203 is offline Advanced Beginner
    Windows XP Access 2000
    Join Date
    May 2010
    Posts
    54
    Quote Originally Posted by Datagopherdan View Post
    That's the problem. It's setting it that value when the form closes. If you don't want that to happen then just remove the code. If you're not 100% sure then what you can do if that's the only thing in the close event is just go to the form's properties, click on the "Events" tab and look for the "On Close". You'll see "[Event Procedure]" next to it. Just delete that. The code will still be there, so you can restore it by simply selecting "Event Procedure" from the drop-down but it will not be triggered anymore.

    Yea I just commented it all out and it seems to work fine now, sweet! Thanks guys.

  6. #6
    Datagopherdan is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Dec 2008
    Posts
    220
    Glad you got it worked out.

    Quote Originally Posted by Kipster1203 View Post
    Yea I just commented it all out and it seems to work fine now, sweet! Thanks guys.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Remove zeros within a number string
    By catguy in forum Queries
    Replies: 3
    Last Post: 02-25-2010, 07:47 AM
  2. 12 Zeros past decimal
    By WhatnThe in forum Access
    Replies: 24
    Last Post: 01-03-2010, 09:53 PM
  3. Getting rid of zeros
    By ceb39 in forum Reports
    Replies: 26
    Last Post: 05-31-2009, 12:49 PM
  4. leading 'Zeros' in data
    By wasim_sono in forum Forms
    Replies: 3
    Last Post: 04-06-2009, 11:57 AM
  5. Viewing ending zeros in decimal
    By duecesup in forum Reports
    Replies: 0
    Last Post: 12-11-2008, 02:45 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums