VBA to display record ID in Textbox within a Form

Mr Retirement

New Member
Joined
Nov 12, 2016
Messages
40
Hello!

Hoping this is a simple question. Is there a way to display the ID (primary key, just the default autonumber) of a Record entry on a form in a textbox?

I am currently able to display the Record Number with the following code which works great but i'm looking for the Primary ID also:

VBA Code:
Private Sub Form_Current()

Me.TXTRecordNumber = Form.CurrentRecord

End Sub
Is there something similar to capture the Primary ID?

Thanks,
Mr R.
 

Some videos you may like

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

welshgasman

Well-known Member
Joined
May 25, 2013
Messages
822
You just use a control bound to the ID ?
Pretty much the same as any other control?
 

Watch MrExcel Video

Forum statistics

Threads
1,102,561
Messages
5,487,575
Members
407,605
Latest member
PACULA

This Week's Hot Topics

Top