navigation button query

fayez_MrExcel

Active Member
Joined
Oct 29, 2005
Messages
439
Office Version
  1. 365
Platform
  1. Windows
I created a unbound form that has a combox with a series of id numbers that when a user choose from it the system will take the values from my Empmaster table which is perfectly okay. My problem is my navigation button, i created below syntax but it doent go to the next record, instead it goes to my message "This is the Last Record". What seems to be the problem. How can i set that the Empmaster table is going to be used to navigate. thanks

Private Sub cmdGoNext_Click()
On Error GoTo Err_Go2Next_Click

DoCmd.GoToRecord , , acNext

Exit_Go2Next_Click:

Exit Sub

Err_Go2Next_Click:

If Err.Number = 2105 Then
MsgBox "This is the Last Record"
Else
MsgBox Err.Description
Resume Exit_Go2Next_Click
End If

End Sub
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
If you want to be able to browse the records, the form must be bound to the table or query.

An unbound form only displays one record at a time; very useful if you have lots of users so you cut down network traffic. Less useful if you only have one or two users.

Denis
 
Upvote 0
As I said before, an unbound form can usually only show one record.

If you need to be able to browse, you will have to build custom navigation buttons to do it. Assuming that your combo pulls in a record based on an ID, you will have to create a Next button that passes the next ID to the combo and requeries the form. The Previous button will have to pass the previous ID to the combo and requery the form.

Denis
 
Upvote 0
thank you sir, if it is not too much can you give me an example of next button syntax i have already created a combo box that pulls in a record based on an ID. thanks
 
Upvote 0

Forum statistics

Threads
1,214,932
Messages
6,122,332
Members
449,077
Latest member
jmsotelo

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