P
peterDavey
G'day all,
I'm pretty new to Access (but have a fair amount of Excel VBA experience) so
I suspect this will be the first of many posts.
I'm creating an Access 2000 front end for a SQL Server database using linked
tables. Most of my forms will be used to maintain reference tables. The
problem I'm having is that when I create a new record (e.g. to add a new
department in the department table), I need to run a query to find the
maximum current value in the primary key column so I can use the next value
for the ID of the new record. I can't use the Access AutoNumber data type
because it isn't supported by SQL Server.
I know the SQL I need to run and I assume that it will need to be run by the
Form_BeforeInsert event/sub but I'm just not sure how I run the SQL to get
the value from within this sub.
I'll be very grateful for any assistance.
cheers
peterDavey
Melbourne
I'm pretty new to Access (but have a fair amount of Excel VBA experience) so
I suspect this will be the first of many posts.
I'm creating an Access 2000 front end for a SQL Server database using linked
tables. Most of my forms will be used to maintain reference tables. The
problem I'm having is that when I create a new record (e.g. to add a new
department in the department table), I need to run a query to find the
maximum current value in the primary key column so I can use the next value
for the ID of the new record. I can't use the Access AutoNumber data type
because it isn't supported by SQL Server.
I know the SQL I need to run and I assume that it will need to be run by the
Form_BeforeInsert event/sub but I'm just not sure how I run the SQL to get
the value from within this sub.
I'll be very grateful for any assistance.
cheers
peterDavey
Melbourne