Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Next Button on Subform

Status
Not open for further replies.

wlssoftware

Technical User
Jul 18, 2003
3
US
I have 8 small tables that I have consolidated into a form with tabs for each table. I do not like the standard record selectors at the bottom of the form and created buttons for all the selections. After a great deal of searching and trial and error is was able to get one set of buttons work for each tab and table. Now I am trying to create a message when the end or the beginning for the records. The code is below. Does anyone have an answer? Thanks.

Private Sub cmdSF1Next_Click()
On Error GoTo Err_cmdSF1Next_Click

Dim numSF1Tab As Integer
Dim strSF1Tab As String

numSF1Tab = Me!TabCtl0.Value

Select Case numSF1Tab

Case 0
strSF1Tab = "Additions"
Forms![Wine SF1]![sf-Additions].SetFocus
DoCmd.GoToRecord , , acNext

If ??????????????? Then
'Check for EOF or BOF
DoCmd.GoToRecord , , acLast
MsgBox "You are at the Last " + strSF1Tab + "!'"
End If

Case 1
strSF1Tab = "Appellations"
Forms![Wine SF1]![sf-Appellation].SetFocus
Case 2
strSF1Tab = "Barrel Types"
Forms![Wine SF1]![sf-BarrelType].SetFocus
Case 3
strSF1Tab = "Bottles"
Forms![Wine SF1]![sf-Bottles].SetFocus

End Select
 
Try the following as a guide.


Also, in the desing view of the form look at the property of the form and change the Navigation Button to NO. Once you do this, you won't be able to ues it to navigate. If you have 100 records, the bof (first record) will indicate 1 of 100.


HTH

An investment in knowledge always pays the best dividends.

by Benjamin Franklin
 
I have tried the code:

Me.NewRecord

but it does not reconize the last record. It seems to go back to the main form.

Thanks anyway.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top