Need help with Autonumber

davin2929

Board Regular
Joined
Oct 13, 2002
Messages
129
I have a data entry form that updates a master table. Each record has an index number (autonumber). I would like to have a "next" and "previous" button so I can cycle through the table and pull the information to the form.
I've gotten as far as creating the two buttons but have no idea how to code them. if someone has any help out there it would be greatly appreciated. thanks!
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Can't you just use the built in navigation buttons?
 
Upvote 0
I'd like to add to this...

I added code to one of my buttons on a form, but when I tried to add code to a second one on the same form, it wouldn't recognize the target text object's control source?

I noticed that the second buttons Sub was in the same procedure as the first button. Is this what's causing the problem? That is, do I need to enter the second button's code somewhere else?
 
Upvote 0
What do you mean it was in the same procedure?

Can you post the actual code?
 
Upvote 0
Hi, norie. I really appreciate you helping me out today!

I right-click Button 1, and use the builder in the On Click event property field to take me to the VBE. I enter this stupidly simple code that enables the EXT_ID and EXT text fields when Button1 is clicked:

Code:
Private Sub Button1_Click()

   [EXT_ID].Enabled = True
   [EXT].Enabled = True

End Sub

Now, when I right-click Button2 and click the builder elipses in the On Click event property field, the VBE opens again, and has put

Code:
Private Sub Button2_Click()
End Sub

in there for me, below the Button1 code as stated above.

So, I enter between this code

Code:
[HG_ID].Enabled = True
[HG].Enabled = True

...and I get an error!

Now, HG_ID is for certain in one of my target fields, as well as HG in another, because when I exit design mode, the numbers are in there. What's going on, you think?
 
Upvote 0

Forum statistics

Threads
1,223,275
Messages
6,171,121
Members
452,381
Latest member
Nova88

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