exporting a record from access to excel

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ashitaka65
    New Member
    • Jul 2007
    • 24

    #16
    i have left it blank..?

    Private Sub export_btn_Clic k()
    DoCmd.TransferS preadsheet acExport, acSpreadsheetTy peExcel9, "orderQ", "C:\Documen ts and Settings\RCTO\D esktop\orders\c urrentorder.xls ", True, ,
    End Sub

    Comment

    • FishVal
      Recognized Expert Specialist
      • Jun 2007
      • 2656

      #17
      So what?
      Does it work?

      Comment

      • ashitaka65
        New Member
        • Jul 2007
        • 24

        #18
        kinda, whats happening is it does export the one line of data,
        but each time i hit the button it exports ontop of the old data, it wont append,
        or wite on the second line insted of the first,

        it just keeps writting on the first line of the excel file and replacing the old info insted of appending

        Comment

        • FishVal
          Recognized Expert Specialist
          • Jun 2007
          • 2656

          #19
          Do you want more reasons to let him rest in peace?

          Comment

          • ashitaka65
            New Member
            • Jul 2007
            • 24

            #20
            what do you mean?
            i'm alittle confused.
            listen if it cant be done or you cant help me then please just say it =D

            Comment

            • FishVal
              Recognized Expert Specialist
              • Jun 2007
              • 2656

              #21
              Originally posted by ashitaka65
              what do you mean?
              i'm alittle confused.
              listen if it cant be done or you cant help me then please just say it =D
              I'd like to get your back to post #13.
              TransferSpreadS heet method is not suited for appending data to existing spreadsheet, read relevant Access help topic carefully.

              Comment

              • ashitaka65
                New Member
                • Jul 2007
                • 24

                #22
                then what cmd should i be using,
                ive tried a few and cant seem to get one to work

                Comment

                • FishVal
                  Recognized Expert Specialist
                  • Jun 2007
                  • 2656

                  #23
                  Originally posted by ashitaka65
                  then what cmd should i be using,
                  ive tried a few and cant seem to get one to work
                  To the best of my knowledge - neither.
                  If all could be achieved with a single command, then what all that programmers for? :)

                  P.S. Did you've tried the code so far?

                  Comment

                  • ashitaka65
                    New Member
                    • Jul 2007
                    • 24

                    #24
                    no i havent tried it,

                    so there would be no cmd i could use to export a line in a form to an excel file?

                    Comment

                    • ashitaka65
                      New Member
                      • Jul 2007
                      • 24

                      #25
                      working on that now, gona give ur code a try

                      Comment

                      • ashitaka65
                        New Member
                        • Jul 2007
                        • 24

                        #26
                        omg it works =D +D =D =D
                        thank you very much, you have made me very happy,
                        only a small problem with the coloms not being in the right order and i'm working on that now =D

                        Comment

                        • ashitaka65
                          New Member
                          • Jul 2007
                          • 24

                          #27
                          now ive fixed that, thank you again for all your help, you have been very amazing and i cant thank you enuff =D

                          Comment

                          • FishVal
                            Recognized Expert Specialist
                            • Jun 2007
                            • 2656

                            #28
                            You are quite welcome.

                            Best regards,
                            Fish

                            Comment

                            • ashitaka65
                              New Member
                              • Jul 2007
                              • 24

                              #29
                              i have a question about code you made me, say i wanted it to start on like the 16h line, so 16,A in my excel sheet, what would i need to change?

                              rivate Sub export_btn_Clic k()

                              Dim appExcel As Excel.Applicati on
                              Dim wkbWorkBook As Excel.Workbook
                              Dim wksSheet As Excel.Worksheet
                              Dim rngOutputTo As Excel.Range

                              ' creates Excel application
                              Set appExcel = CreateObject("E xcel.Applicatio n")
                              ' opens workbook for output (C:\target.xls)
                              Set wkbWorkBook = appExcel.Workbo oks.Open("C:\Do cuments and Settings\RCTO\D esktop\orders\P RD-F-09 Pickup Confirmation.xl s")
                              ' get reference to sheet for output (Sheet1)
                              Set wksSheet = wkbWorkBook.Wor ksheets("Sheet1 ")

                              ' get A-cell in the first empty row
                              Set rngOutputTo = wksSheet.Cells. SpecialCells(xl CellTypeLastCel l)
                              Set rngOutputTo = wksSheet.Cells( rngOutputTo.Row + 1, 1)

                              ' output all fields in the record
                              For Each fld In Me.Recordset.Fi elds
                              rngOutputTo.Val ue = fld.Value
                              Set rngOutputTo = rngOutputTo.Off set(ColumnOffse t:=1)
                              Next

                              ' save and quit
                              wkbWorkBook.Sav e
                              appExcel.Quit

                              Set rngOutputTo = Nothing
                              Set wksSheet = Nothing
                              Set wkbWorkBook = Nothing
                              Set appExcel = Nothing

                              'deletes current record from inventory
                              'DoCmd.DoMenuIt em acFormBar, acEditMenu, 8, , acMenuVer70
                              'DoCmd.DoMenuIt em acFormBar, acEditMenu, 6, , acMenuVer70

                              End Sub

                              Comment

                              • FishVal
                                Recognized Expert Specialist
                                • Jun 2007
                                • 2656

                                #30
                                Originally posted by ashitaka65
                                i have a question about code you made me, say i wanted it to start on like the 16h line, so 16,A in my excel sheet, what would i need to change?
                                If you have not empty cell in row #15 in you excel file, then the output will go to row #16 and so on. The code just appends new data to the row after the last used.

                                Comment

                                Working...