Peter Bellamy
Registered User.
- Local time
- Today, 21:36
- Joined
- Dec 3, 2005
- Messages
- 295
I have been trying to write some code which will lookup the first, last and record count the entries in several tables. All the tables have the same structure and naming convention so I hoped to right a 'universal' DFirst/Dlast/Dcount set of statements and just pass the 'names' over as variables
The Table name is set by a button click, eg
tablename = Table1
tableshortname = table
It then jumps to a subroutine which has the DFirst, DLast and Dcount statements.
The problem is that I cannot get the syntax right so reads the Table and field names names correctly.
serial = tableshortname & "_serialno" ' concatanates to table_serialno
Then, for example
firstrec = DFirst("serial", "tablename") Which does not not work !
Which is trying to say :
firstrec = DFirst("[table_serialno]", "Table1")
Any suggestions please?
Cheers
The Table name is set by a button click, eg
tablename = Table1
tableshortname = table
It then jumps to a subroutine which has the DFirst, DLast and Dcount statements.
The problem is that I cannot get the syntax right so reads the Table and field names names correctly.
serial = tableshortname & "_serialno" ' concatanates to table_serialno
Then, for example
firstrec = DFirst("serial", "tablename") Which does not not work !
Which is trying to say :
firstrec = DFirst("[table_serialno]", "Table1")
Any suggestions please?
Cheers