Reading Current Record

Kavy

Well-known Member
Joined
Jun 25, 2007
Messages
607
Hello, using this method I added a record, but now I want to return the "key" the number access assgins to my record in the first collumn.

The variable I want to retrieve is called donum in my code, and do in the record collumn

<code>
With rstdept
.Addnew
!TAmount = bla
!something = blaaa
.update
End with

donum = rstdept.??????

</code>


Thanks for any help!
 

Some videos you may like

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

SydneyGeek

MrExcel MVP
Joined
Aug 5, 2003
Messages
12,251
Assuming your ID field is DeptID, you could replace this...

Code:
<code>donum = rstdept.??????

with
Code:
rstdept.MoveLast
</code><code>donum = rstdept.DeptID
Denis
</code>
 

Kavy

Well-known Member
Joined
Jun 25, 2007
Messages
607
Thank you, I dont know why, I was struggling to find the syntax for this!
 

Kavy

Well-known Member
Joined
Jun 25, 2007
Messages
607
Just for anyone who searches this msg bored, and to make sure I am doing it correct, I replaced the "." with a "!" and it worked
 

Watch MrExcel Video

Forum statistics

Threads
1,122,657
Messages
5,597,391
Members
414,142
Latest member
Banyangt

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top