Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / July 2007

Tip: Looking for answers? Try searching our database.

Last record problem, is it really the last record?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
efandango - 23 Jul 2007 00:06 GMT
I have this code on a button that when pressed copies the data from the field
'run_waypoint' (based on a combo box) from each record on the source form to
a set of sequential fields [GetRound_#] on the target form. All works ok,
except that the code always goes one extra step and copies the "," comma from
the last field string. It's as if the last source record isn't really what it
seems...

I have tried using these two code snippets to register either the end of
records or the last empty field, but neither method seems to stop this
happening?, can someone help me solve this problem? What am I doing wrong?

If Me.Recordset.EOF = True Then
       MsgBox "cannot go to next record"
   Else
       DoCmd.GoToRecord , , acNext
   End If

If Me.CurrentRecord < Me.Recordset.RecordCount Then DoCmd.GoToRecord , ,
acNext

End If

MY CODE

Forms.frm_Runs.[frm_Getround_MapMaker].Form.[GetRound_1] = Me.Run_waypoint
& ", " & Me.Postcode

If Me.Recordset.EOF = True Then
       MsgBox "cannot go to next record"
   Else
       DoCmd.GoToRecord , , acNext
   End If

Forms.frm_Runs.[frm_Getround_MapMaker].Form.[GetRound_2] = Me.Run_waypoint
& ", " & Me.Postcode

If Me.Recordset.EOF = True Then
       MsgBox "cannot go to next record"
   Else
       DoCmd.GoToRecord , , acNext
   End If

Forms.frm_Runs.[frm_Getround_MapMaker].Form.[GetRound_3] = Me.Run_waypoint
& ", " & Me.Postcode

If Me.Recordset.EOF = True Then
       MsgBox "cannot go to next record"
   Else
       DoCmd.GoToRecord , , acNext
   End If

   Forms.frm_Runs.[frm_Getround_MapMaker].Form.[GetRound_4] =
Me.Run_waypoint & ", " & Me.Postcode

If Me.Recordset.EOF = True Then
       MsgBox "cannot go to next record"
   Else
       DoCmd.GoToRecord , , acNext
   End If

 Forms.frm_Runs.[frm_Getround_MapMaker].Form.[GetRound_5] = Me.Run_waypoint
& ", " & Me.Postcode

If Me.Recordset.EOF = True Then
       MsgBox "cannot go to next record"
   Else
       DoCmd.GoToRecord , , acNext
   End If
efandango - 23 Jul 2007 01:44 GMT
I HAVE NOW SOLVED THIS PROBLEM...

The answer was to keep it simple and rewrite the code:

If IsNull(Me.[Run_waypoint]) Then
End
Else
Forms.frm_Runs.[frm_Getround_MapMaker].Form.[GetRound_1] = Me.Run_waypoint &
", " & Me.Postcode
DoCmd.GoToRecord , , acNext
End If

If IsNull(Me.[Run_waypoint]) Then
'MsgBox "TEST cannot go to next record"
End
Else
Forms.frm_Runs.[frm_Getround_MapMaker].Form.[GetRound_2] = Me.Run_waypoint &
", " & Me.Postcode
DoCmd.GoToRecord , , acNext
End If

If IsNull(Me.[Run_waypoint]) Then
'MsgBox "TEST cannot go to next record"
End
Else
Forms.frm_Runs.[frm_Getround_MapMaker].Form.[GetRound_3] = Me.Run_waypoint &
", " & Me.Postcode
DoCmd.GoToRecord , , acNext
End If

If IsNull(Me.[Run_waypoint]) Then
'MsgBox "TEST cannot go to next record"
End
Else
Forms.frm_Runs.[frm_Getround_MapMaker].Form.[GetRound_4] = Me.Run_waypoint &
", " & Me.Postcode
DoCmd.GoToRecord , , acNext
End If

> I have this code on a button that when pressed copies the data from the field
> 'run_waypoint' (based on a combo box) from each record on the source form to
[quoted text clipped - 64 lines]
>         DoCmd.GoToRecord , , acNext
>     End If
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.