Afternoon all,
Sorry to do this, i know the subject has been covered numerous times, I've searched for the threads, read the threads and understood entirely none of it.
So let me explain what I'm trying to do. I've created a simple database that splits out one table into several based on company name. Nice and simple, no problems. The next thing i wanted to do was export the newly created tables into an excel file with a new tab for each of the companies. But this produced lots of errors after using the macro builder which caused me to look for more answers. In the end I ditched the macro builder in favour of some VBA that was posted...I pasted this into a module...clicked run and it went through like a charm. Hurrah! Problem solved.
But no...didn't realise that you couldn't simply run a module...so I've tried attaching it to a macro using the builder...it just opens the module which isn't what I was hoping it would do.
There has been a lot said about applying procedures and functions and the like but the simple truth of the matter is i just don't 'get it'...
Query looks like this (strPath has been changed as it contained my company name, company names have been changed as they contain customer names)
Private Sub Command0_Click()
strPath = "desktopyaddayaddayadda\Remittance Database Test.xls"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12, "company1", strPath
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12, "company2", strPath
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12, "company3", strPath
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12, "company4", strPath
End Sub
If someone can explain, like you would to a 6 year old or learning impaired chicken, how functions and procedures are used in a situation like this it would be very much appreciated. All i want to do is click on a form button and run the damn thing.
Thanks in advance,
Ross
Sorry to do this, i know the subject has been covered numerous times, I've searched for the threads, read the threads and understood entirely none of it.
So let me explain what I'm trying to do. I've created a simple database that splits out one table into several based on company name. Nice and simple, no problems. The next thing i wanted to do was export the newly created tables into an excel file with a new tab for each of the companies. But this produced lots of errors after using the macro builder which caused me to look for more answers. In the end I ditched the macro builder in favour of some VBA that was posted...I pasted this into a module...clicked run and it went through like a charm. Hurrah! Problem solved.
But no...didn't realise that you couldn't simply run a module...so I've tried attaching it to a macro using the builder...it just opens the module which isn't what I was hoping it would do.
There has been a lot said about applying procedures and functions and the like but the simple truth of the matter is i just don't 'get it'...
Query looks like this (strPath has been changed as it contained my company name, company names have been changed as they contain customer names)
Private Sub Command0_Click()
strPath = "desktopyaddayaddayadda\Remittance Database Test.xls"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12, "company1", strPath
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12, "company2", strPath
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12, "company3", strPath
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12, "company4", strPath
End Sub
If someone can explain, like you would to a 6 year old or learning impaired chicken, how functions and procedures are used in a situation like this it would be very much appreciated. All i want to do is click on a form button and run the damn thing.
Thanks in advance,
Ross