Hi
I need help writing a bit of VBA code as I'm not really too familiar with it all.
I created the following to import a spreadsheet according to the values on a form and it works OK
Private Sub Command12_Click()
Dim InputDir, ImportFile, ImportExtension As String
InputDir = Forms![Input details].[Field1]
ImportFile = Forms![Input details].[Field2]
ImportExtension = Forms![Input details].[Field3]
DoCmd.TransferSpreadsheet acImport, , "DC Master Gelligron1", InputDir & ImportFile & "." & ImportExtension, True, ""
End Sub
However, I actually want to import a number of spreadsheets based on a screenful of data (i.e. a number of different records). The info will be on a table and will be displayed on the form (in Field1, Field2 and Field3 or whatever they end up being called). The name of the table will also be held in a field on the form - i.e. the "DC Master Gelligron1" will be changed, so don't worry about that.
How do I construct a loop or a DO While Not EOF or similar. I've been trying to cobble something together from other threads here but am failing.
I'm sure this has been answered before somewhere but would appreciate the help.
Thanks
Andrew
I need help writing a bit of VBA code as I'm not really too familiar with it all.
I created the following to import a spreadsheet according to the values on a form and it works OK
Private Sub Command12_Click()
Dim InputDir, ImportFile, ImportExtension As String
InputDir = Forms![Input details].[Field1]
ImportFile = Forms![Input details].[Field2]
ImportExtension = Forms![Input details].[Field3]
DoCmd.TransferSpreadsheet acImport, , "DC Master Gelligron1", InputDir & ImportFile & "." & ImportExtension, True, ""
End Sub
However, I actually want to import a number of spreadsheets based on a screenful of data (i.e. a number of different records). The info will be on a table and will be displayed on the form (in Field1, Field2 and Field3 or whatever they end up being called). The name of the table will also be held in a field on the form - i.e. the "DC Master Gelligron1" will be changed, so don't worry about that.
How do I construct a loop or a DO While Not EOF or similar. I've been trying to cobble something together from other threads here but am failing.
I'm sure this has been answered before somewhere but would appreciate the help.
Thanks
Andrew