Navigation Button

  • Thread starter Thread starter vinay
  • Start date Start date
V

vinay

Guest
I have placed a command Button onto the form to go to the next record. Problem is that when I am reaching to the last record and do click on this button it gives a balnk form.

I want if I reach to the last record and click on next button it should display a message and not add a balnk record.
 
vinay,

if you set the form property "Allow Additions" to No, it will stop this. However, If you want to create a new record then you will need to add the code to change the Allow Additions to true, and then off again once the record is created.

Hope this helps, Peter
 
I had a problem once were when button was clicked it would just set the focus to the subform and goto the new record. the side effects of this was I had a event procedure in the field that got the focus and spent HOURS on this tring to figure this out.

So question is: Do you have anything in the coding of the form that may trigger something else?
 
Thanks for helping.

I would like to make more clear my problem so you can help in better way.

1) Form containing a new button.If you have entered a record and want to add more then click on this button it will valid the entry if o.k then allow another record else give a error messege. It is working fine only problem is that form on load I have to move to a new record.

2) If after entering a new record someone click on next button it allow without validation.
I want to stop this with following piece of code, But not working.

Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
rs.Open "select * from certf_det", CurrentProject.Connection, adOpenDynamic, adLockReadOnly
If rs.EOF Then

MsgBox "you are at the last record"
Form.AllowAdditions = False
Exit Sub
Else
DoCmd.GoToRecord , , acNext
End If


I hope you will help me to come out this problem. I have been stucked here from last three day.
 

Users who are viewing this thread

Back
Top Bottom