Populate variable using SQL

  • Thread starter Thread starter Al
  • Start date Start date
A

Al

I want to populate a variable, MaxID, with the highest ID
in the PROJECT table. The ID field is an Integer. I want
to add 1 to MaxID, place a text prefix on it of "PM" and
insert it back into the PROJECT table in a PMID text field
(This will be used to link it to a Public Meeting record
in another table)

How do I populate the MaxID variable? (Access 2000)

TIA,
Al
 
Al said:
I want to populate a variable, MaxID, with the highest ID
in the PROJECT table. The ID field is an Integer. I want
to add 1 to MaxID, place a text prefix on it of "PM" and
insert it back into the PROJECT table in a PMID text field
(This will be used to link it to a Public Meeting record
in another table)

How do I populate the MaxID variable? (Access 2000)

This is a VB.NET language group. Please turn to the ADO.NET newsgroup:

news://msnews.microsoft.com/microsoft.public.dotnet.framework.adonet

Web interface:

http://msdn.microsoft.com/newsgroup...roup=microsoft.public.dotnet.framework.adonet
 
Use cmd.ExecuteScalar with commandtext like
SELECT 'PM' + Convert(Varchar(MAX(ID) + 1))
 
Back
Top