M
Maverick6197 via AccessMonster.com
I've posted this before and have not had any responses, must be a hard one....
.....
Need some help.......
I've been using a database to log warranty registrations for about 3 years
now. I import the data from Warranty Registrations submitted to me in Excel
format.
I designed the Excel forms so that a user could use drop-downs, checkboxes,
and regular fields to input their data. For the most part everything works
fine. Here is my problem and what I would like to be able to do........
I have a button on my form that I push to import a new registration (excel
file). I would like to be able to push the button, have the button open the
excel document, run a macro to clear the spaces that people have inserted in
some fields (instead of using the delete key to clear a field, some people
use the space bar....this is very annoying), import the file, perform a "save
as" on the file and build the file name from the data within it (3 cells in
the document), and finally print the file and close it.
Here is the code I'm using now to import it........
--------start code-------------
Private Sub cmdImport_Click()
Me.Refresh
Me!txtImportFile = LaunchCD(Me)
Dim FileName1 As String
FileName1 = Me.txtImportFile
If FileName1 = "" Then
GoTo Exit_cmdImportWarrantyReg_Click
End If
Me.Refresh
DoCmd.TransferSpreadsheet acImport, , "Import: tblWarrantyReg",
FileName1, -1, "tblWarrantyReg!A1:AB2"
DoEvents
Me.Refresh
Dim stDocName3 As String
stDocName3 = "Append: tblWarrantyReg"
DoCmd.OpenQuery stDocName3, acNormal, acEdit
Me.Refresh
DoEvents
Dim stDocNameW As String
stDocNameW = "DELETE: Import: tblWarrantyReg"
DoCmd.OpenQuery stDocNameW, acNormal, acEdit
Me.Refresh
DoEvents
DoCmd.Close
DoCmd.OpenForm "frmWarrantyRegistration"
DoCmd.GoToRecord , , acLast
Exit_cmdImportWarrantyReg_Click:
Exit Sub
End Sub
------------end code-------------
If anyone has any idea how to go about this, I would appreciate it....Thanks
in advance.....
Shannan
.....
Need some help.......
I've been using a database to log warranty registrations for about 3 years
now. I import the data from Warranty Registrations submitted to me in Excel
format.
I designed the Excel forms so that a user could use drop-downs, checkboxes,
and regular fields to input their data. For the most part everything works
fine. Here is my problem and what I would like to be able to do........
I have a button on my form that I push to import a new registration (excel
file). I would like to be able to push the button, have the button open the
excel document, run a macro to clear the spaces that people have inserted in
some fields (instead of using the delete key to clear a field, some people
use the space bar....this is very annoying), import the file, perform a "save
as" on the file and build the file name from the data within it (3 cells in
the document), and finally print the file and close it.
Here is the code I'm using now to import it........
--------start code-------------
Private Sub cmdImport_Click()
Me.Refresh
Me!txtImportFile = LaunchCD(Me)
Dim FileName1 As String
FileName1 = Me.txtImportFile
If FileName1 = "" Then
GoTo Exit_cmdImportWarrantyReg_Click
End If
Me.Refresh
DoCmd.TransferSpreadsheet acImport, , "Import: tblWarrantyReg",
FileName1, -1, "tblWarrantyReg!A1:AB2"
DoEvents
Me.Refresh
Dim stDocName3 As String
stDocName3 = "Append: tblWarrantyReg"
DoCmd.OpenQuery stDocName3, acNormal, acEdit
Me.Refresh
DoEvents
Dim stDocNameW As String
stDocNameW = "DELETE: Import: tblWarrantyReg"
DoCmd.OpenQuery stDocNameW, acNormal, acEdit
Me.Refresh
DoEvents
DoCmd.Close
DoCmd.OpenForm "frmWarrantyRegistration"
DoCmd.GoToRecord , , acLast
Exit_cmdImportWarrantyReg_Click:
Exit Sub
End Sub
------------end code-------------
If anyone has any idea how to go about this, I would appreciate it....Thanks
in advance.....
Shannan