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

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
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>
 
Upvote 0
Thank you, I dont know why, I was struggling to find the syntax for this!
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,561
Members
449,089
Latest member
Motoracer88

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
Back
Top