0

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.

5
  • 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. Commented Aug 6, 2013 at 15:56
  • Although that may fix the first problem I am still unable to GoToRecord Commented Aug 6, 2013 at 15:59
  • 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) Commented Aug 6, 2013 at 16:04
  • 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. Commented Aug 6, 2013 at 16:22
  • 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) Commented Aug 6, 2013 at 16:29

1 Answer 1

0

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.