Link to home
Start Free TrialLog in
Avatar of datasolutionz
datasolutionz

asked on

How to Go To Specific record on Access form using VBA on Unbound control

On my Access form, instead of using the "Navigation Buttons" property turned On, I am creating my own controls for Navigation. In order to display the current record that user is on, I have a text box "txtCurrentRecordNo" on the form whose Control Source is set as '=[CurrentRecord]'. In the native Access Record Navigator, if user types in a number in the textbox & presses ENTER, the form moves to that specific record #. I want to replicate the same functionality but my textbox txtCurrentRecordNo does NOT allow me to type anything in it. How do I replicate that functionalty?
ASKER CERTIFIED SOLUTION
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I think you are going to have to supply some more info on this one.  What is the primary key of your table?  Does each record have an associated number or autonumber assigned to it?  If so, you don't need to use the =[CurretnRecord] at all.  Just display the primary key, and give that field and after update event to look up and display the fields current value as current record.

TLh
Avatar of datasolutionz
datasolutionz

ASKER

DatabaseMX - The above solution is good, but I THINK there is a flaw. if user clicks on the NEW record button to start a new record, that button remains disabled even after the user has entered some data on the form. Normally, as soon as any data is entered on a NEW record, that record is no longer new & the NEW record button should no longer be disabled. Any thoughts around solution? I would think that somehow determine if the Form is Dirty...but I dont know how to imlplement that. Your genius thoughts are anticipated :-)
Haven't looked at that code for a long time.

However, you could use the Form Dirty event to enable the New Record button as soon as the record becomes Dirty.

See attached screen shot.

mx

Capture1.gif
Thanks MX....that works well!
No doubt a small oversight on Leban's part :-)

And a good catch on your part !

mx