My VB knowledge is minimal, I used to be more proficient at it, but I found it isn't like riding a bicycle...at least not for me.
Once upon a time, I had a DB that did exactly what I am looking to do, but I can't for the life of me figure out how to code it.
I have a button on a form, that when the button is pushed, is SUPPOSED to create an XLS output file based on what is showing in the subform/datasheet, and then pop-up a message box saying its done. So far, the only thing it does is popup the message box, until I moved it after the file creation.
The file created is supposed to be placed at s:\Exports and is supposed to be named <the value in the Name field><date()>.xls
The main form is frmSubmitTime. The sub form/datasheet is frmTimeSheetReview.
Please help me solution this.
Once upon a time, I had a DB that did exactly what I am looking to do, but I can't for the life of me figure out how to code it.
I have a button on a form, that when the button is pushed, is SUPPOSED to create an XLS output file based on what is showing in the subform/datasheet, and then pop-up a message box saying its done. So far, the only thing it does is popup the message box, until I moved it after the file creation.
The file created is supposed to be placed at s:\Exports and is supposed to be named <the value in the Name field><date()>.xls
The main form is frmSubmitTime. The sub form/datasheet is frmTimeSheetReview.
Code:
Private Sub modSubmitData()
On Error GoTo modSubmitData_Err
Dim strfile1 As String
strfile1 = "s:\Exports\" & frmTimeSheetReview.Name & Date() & ".xls"
DoCmd.OutputTo acOutputForm, "frmTimeSheetReview", "Excel97-Excel2003Workbook(*.xls)", strfile1, False, "", , acExportQualityPrint
MsgBox "Time submitted.", vbOKOnly, "Time submital"
modSubmitData_Exit:
Exit Sub
modSubmitData_Err:
MsgBox Error$
Resume modSubmitData_Exit
End Sub
Please help me solution this.