Create a variable from a record in a table

  • Thread starter Thread starter Geoff Salmon
  • Start date Start date
G

Geoff Salmon

I want to create a series of tables from a series of Excel spreadsheets. I
have set up a table with the list of the spreadsheets called 'stcknames'.

I then used a command to go to each record in that table. That seems to
work. But I don't know how to access that record and use it as a variable
in the next command set out below. I am missing something basic. I don't
know how to capture the record as then use it as a variable, call it
'nwtable'.

Any help would be appreciated and if the approach itself is misguided, I
would appreciate further direction.

Here is what I have tried to date

Sub NewTabl()

For n = 1 To 2
DoCmd.GoToRecord acDataTable, "stcknames", acGoTo, n

nwtble = ???

DoCmd.TransferSpreadsheet acImport, 8, _
nwtble, "C:\GeoffsFolders\stockdata\stcknames.XLS", True, "a1:f765"
Next n
End Sub
 
I take it the names you read in are from a text field in the table. Yo
can do the transferspreadsheet where nwtable = text field content.
This should create a new table if one by that name did not exist.

if you are using gotrecord then you must have a recordset available fo
it to act on. so if rs = recordset object then

nwtable = rs!textfieldthathasexcelfilenam
 
I take it the names you read in are from a text field in the table. Yo
can do the transferspreadsheet where nwtable = text field content.
This should create a new table if one by that name did not exist.

if you are using gotrecord then you must have a recordset available fo
it to act on. so if rs = recordset object then

nwtable = rs!textfieldthathasexcelfilenam
 
I take it the names you read in are from a text field in the table. Yo
can do the transferspreadsheet where nwtable = text field content.
This should create a new table if one by that name did not exist.

if you are using gotrecord then you must have a recordset available fo
it to act on. so if rs = recordset object then

nwtable = rs!textfieldthathasexcelfilenam
 
I take it the names you read in are from a text field in the table. Yo
can do the transferspreadsheet where nwtable = text field content.
This should create a new table if one by that name did not exist.

if you are using gotrecord then you must have a recordset available fo
it to act on. so if rs = recordset object then

nwtable = rs!textfieldthathasexcelfilenam
 
Back
Top