I'm just starting to play with Access after getting a basic grasp of VB in Excel.
I have a really basic problem which despite hours of surfing I can't find the answer to;
I have done a very basic table with 2 fields. Table called 2984 and field 1st field called ServiceNo.
The serviceno values stepping up incriments of 0.5
All i want to do is get the highest value in the column ServiceNo and add 2 to it ( the rest i'll be abe to work out). then put the new value back into the table as a new record. I've been round and round in circles with code so i must be missing something very basic in my understanding.
Any help would be great to get me started, thanks
I have been playing with the following code without any joy
I have a really basic problem which despite hours of surfing I can't find the answer to;
I have done a very basic table with 2 fields. Table called 2984 and field 1st field called ServiceNo.
The serviceno values stepping up incriments of 0.5
All i want to do is get the highest value in the column ServiceNo and add 2 to it ( the rest i'll be abe to work out). then put the new value back into the table as a new record. I've been round and round in circles with code so i must be missing something very basic in my understanding.
Any help would be great to get me started, thanks
I have been playing with the following code without any joy
Code:
Sub New_Day_Member_Table()
Dim Dty As Single
Dim Dte As String
DoCmd.SetWarnings False
[COLOR=red]Dte=DoCmd.RunSQL "SELECT MAX(ServiceNo)FROM 2984;"[/COLOR] [COLOR=lime]' i want to assign Dte to the value of the highest value in ServiceNo[/COLOR]
Dty = Dte + 2
DoCmd.RunSQL "INSERT INTO 2984(ServiceNo, Duty) values(' " & Dty + 2 & " ', ""Day"");"
DoCmd.RunSQL "INSERT INTO 2984(ServiceNo, Duty) values(' " & Dty + 0.5 & " ', ""Night"");"
End Sub