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!
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

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
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,168,088
Messages
5,857,290
Members
431,869
Latest member
Avinashz

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