0
votes

I have a Form in MS Access 2010. The form is bound to a record source (just a simple table). I am trying to use code like the following :

Change a field in the table (the current record) to another value (error is the field is not defined in VBA which causes it to not change in the table)

AFieldInTheTable = Value

Go to another record in the table (error is nothing happens at all)

DoCmd.GoToRecord acDataForm, Me.Name, acNewRec

Is there some option I am not setting because I tried building the form using the built in wizard and from a blank form but still no difference.

It is like Access doesn't know that the form is bound to the table. But I know that it is. So frustrating.

1
Try using the control name instead of the field name. I generally make sure that bound controls have the same name as their field, even if some may not agree with that. - Patrick Honorez
Although that may fix the first problem I am still unable to GoToRecord - Logan Murphy
Maybe your problem with the GoToRecord might be that edits or additions aren't allowed therefore it doesn't allow you to go to acNewRec (Just guessing) - ashareef
Try acNext or acLast and see if that's better. Also add a debug.print "test" or a MsgBoxto ensure you running through that code. - Patrick Honorez
I have break points that are triggered. 99.9% sure nothing wrong with code. There is just one option I am missing. I see that the table is bound but Access is not recognizing it is bound (not even the textboxes work in vba) - Logan Murphy

1 Answers

0
votes

You cannot access / alter properties of a form using public functions which were called by other forms.

Only during events of the form can you perform actions with that form.