disable input controls until edit/update

grooving

New member
Local time
Today, 09:40
Joined
Jul 27, 2006
Messages
4
Hi all,

I have a form that displays fields from two tables. I have set the properties of Allow Edit, Allow Additions, Allow Update, Data Entry to NO. However I want to allow users to be able to add new, edit/update and delete records from the form by clicking on respective command buttons.

the problem is that the code that I am using is giving me errors that says that I "You cannot go to the specified field" I need help on proper VB code to use that will allow me to enable input and update on the records in the table.

Private Sub cmdAdd_Click()

Me.Location_ID.Locked = False
Me.Location_Parent.Locked = False
Me.Zone.Locked = False
Me.Description.Locked = False
Me.Child12.Locked = False

DoCmd.GoToRecord , , acNewRec

End Sub

Dont know if that makes any sense, but I want to add a new record and i get errors

Neeeeeed some help ASAP....
 
You will need to set Allow Additions True to use your code.
 
thanks much RuralGuy...so simple but it worked!!! :-)
Blessings
 
Another thing, you know when you are navigating through a from and the the next button reaches a null value, because it is the end of the record, How do i prevent it from gererating an error.

For example
Private Sub cmdNext_Click()

'go to the next record in the table
DoCmd.GoToRecord acDataForm, "Location", acNext

End Sub
 
You could always just trap the error in the Next_Click routine and see if it is trying to tell you "no next" - or just assume "no next."

On Error Goto target-label

If you take the GoTo, there probably IS no next to do an acNext on.
 

Users who are viewing this thread

Back
Top Bottom