dcsimg
Results 1 to 8 of 8

Thread: Missing record after export from Access

  1. #1

    Thread Starter
    Addicted Member alexia_net's Avatar
    Join Date
    Jun 2006
    Posts
    216

    Missing record after export from Access

    Hi. I am having a strange problem with one of my programs. Let say that I have the fields A,B,C,D,E,F and records 1,2,3,4,5,6. I store all this information into an access table and the export it to excel. The problem is that if for all records the fields D,E,F are empty, the record 2 will not be exported into excel. This happens only when I use the *.exe file which I generate. If I run the program locally, using the code it is ok, but when I use the *.exe file the I have this problem. I store all information as string because I do not always need 0 in case the result is 0. Is there a bug in VB? Thank you!

  2. #2
    Super Moderator Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,335

    Re: Missing record after export from Access

    What in the world is a *.exe program?
    Please use [Code]your code goes in here[/Code] tags when posting code.
    When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    I dont answer coding questions via PM or EMail. Please post a thread in the appropriate forum section.

    Creating A Wizard In VB.NET
    Paging A Recordset
    What is wrong with using On Error Resume Next
    Good Article: Language Enhancements In Visual Basic 2010
    Upgrading VB6 Code To VB.NET
    Microsoft MVP 2005/2006/2007/2008/2009/2010/2011/2012/Defrocked

  3. #3

    Thread Starter
    Addicted Member alexia_net's Avatar
    Join Date
    Jun 2006
    Posts
    216

    Re: Missing record after export from Access

    Hi. When you create a program you can create an *.exe file for that progra, so this way everyone will be able to use it. So I write the code for my program and the I create the *.exe file.

  4. #4
    Super Moderator Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,335

    Re: Missing record after export from Access

    Ok, I think I know what you mean.

    What is the code you are using to INSERT your records into the database?
    Please use [Code]your code goes in here[/Code] tags when posting code.
    When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    I dont answer coding questions via PM or EMail. Please post a thread in the appropriate forum section.

    Creating A Wizard In VB.NET
    Paging A Recordset
    What is wrong with using On Error Resume Next
    Good Article: Language Enhancements In Visual Basic 2010
    Upgrading VB6 Code To VB.NET
    Microsoft MVP 2005/2006/2007/2008/2009/2010/2011/2012/Defrocked

  5. #5

    Thread Starter
    Addicted Member alexia_net's Avatar
    Join Date
    Jun 2006
    Posts
    216

    Re: Missing record after export from Access

    Hi. The code is as follow: insert into fields values.
    q = " insert into " & Table_EPL & "( A,B,C,D,E,F) " & _
    " values('" & 1 & "' , '" & 2 & "', '" & 3 & "', '" & 4 & "', " & _
    " '" & 5 & "' , '" & 6 & "') "
    db.Execute (q)
    Thank you!

  6. #6
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    Re: Missing record after export from Access

    There is no bug for that in VB unless you count the coder...

    We can't tell what you are doing unless you supply code and if you are going to post SQL statement please post the statement with all parameters in the state that all the variables have been replaced...

  7. #7

    Thread Starter
    Addicted Member alexia_net's Avatar
    Join Date
    Jun 2006
    Posts
    216

    Re: Missing record after export from Access

    Hi. This is the code. All variables are string, and the problem occurs when all variables starting from "nrpnpl " are null, blank. Thank you!

    q = " insert into " & Table_EPL & "( MARK, BB, PD, TB, NR_PIESE, DESCRIERE, TIP_PIESA, MATERIAL, " & _
    " LUNGIME, LATIME, GROSIME, GREUTATE_PIESA, GREUTATE_TOTALA, NR_PIESE_NESTATE, " & _
    " NEST, CALITATE_NEST, LUNGIME_NEST, LATIME_NEST, GROSIME_NEST, BAB, CEN, TRB, SYM_NEST) " & _
    " values('" & mark & "' , '" & bbpl & "', '" & cenpl & "', '" & tbpl & "', " & _
    " '" & nrpl & "' , '" & desc & "', '" & type_el & "', '" & mat & "', " & _
    " '" & lupl & "', '" & lapl & "', '" & tkpl & "', '" & grpl & "', '" & gr_totpl & "', '" & nrpnpl & "', " & _
    " '" & nest & "', '" & cal_nest & "', '" & nestlungpl & "', '" & nestlatpl & "', '" & tk_nest & "', '" & bb_nestpl & "', " & _
    " '" & pd_nestpl & "', '" & tb_nestpl & "', '" & str_simetrie_nest & "' ) "
    db.Execute (q)

  8. #8
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    Re: Missing record after export from Access

    First you have to read and comprehend that which is written. That SQL statement does not have all the variables replaced with what they should be.

    Try Using

    Debug.Print q


    in the IDE at the location you assign q then post what is displayed in the Immediate window...

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width