cannot change controls on form or subform

Pat
5StarLounger
Posts: 1148
Joined: 08 Feb 2010, 21:27

cannot change controls on form or subform

Post by Pat »

I have a main form with 2 sub forms.
Inthe form load event is where i populate a table behind one of the sub forms and also enable certain buttons.
Nothing is locked.
There are no child master links as there is no need for them.
After populating the table i setup the SourceObject of the subform as there can be 2 of these.
I then requery the subform, but after all of this i cannot change anything on the main form or subform.

Any ideas.
.

User avatar
HansV
Administrator
Posts: 78545
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: cannot change controls on form or subform

Post by HansV »

Have you checked the Allow Edits and Recordset Type properties of the form and subform? The first should be set to Yes, and the second to Dynaset.
Also make sure that the Record Source of both the form and subform is updateable.
Best wishes,
Hans

Pat
5StarLounger
Posts: 1148
Joined: 08 Feb 2010, 21:27

Re: cannot change controls on form or subform

Post by Pat »

Checked all that. All ok.
Another question, can i run a sub (in the Mainform) from a subform?

User avatar
HansV
Administrator
Posts: 78545
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: cannot change controls on form or subform

Post by HansV »

If you still need help with not being able to change anything, could you attach a stripped down, compacted and zipped copy of the database?

You can run a public sub MyProc that is defined in the main form from a subform as follows:

Call Parent.MyProc
Best wishes,
Hans

Pat
5StarLounger
Posts: 1148
Joined: 08 Feb 2010, 21:27

Re: cannot change controls on form or subform

Post by Pat »

Unfortunately my BE is SQL Server.
Thanks re the sub call.
Another question here, how do i populate a main form variable (defined by Dim prior to the subs of the main form), does this variable need to be defined as a public dim?

User avatar
HansV
Administrator
Posts: 78545
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: cannot change controls on form or subform

Post by HansV »

Yes, you must declare the variable as Public:

Public strTest As String

You can then use the following from the subform:

Parent.strTest = "Eileen"

to set the variable, or

MsgBox Parent.strTest

to retrieve the value of the variable.
Best wishes,
Hans

Pat
5StarLounger
Posts: 1148
Joined: 08 Feb 2010, 21:27

Re: cannot change controls on form or subform

Post by Pat »

Thank you.
I think I may have found what the problem is, it is continually calling the routine which populates the table behind the subform and so literally freezes it but i can get to the ActiveX control being a Calender control, i need to find out why it is happening.

Pat
5StarLounger
Posts: 1148
Joined: 08 Feb 2010, 21:27

Re: cannot change controls on form or subform

Post by Pat »

I had put a call to build the table again in the Exit event of the calendar control.
What is the OnExit event used for in this ActiveX control, same question for the OnUpdated event of the calender control.

User avatar
HansV
Administrator
Posts: 78545
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: cannot change controls on form or subform

Post by HansV »

The On Exit event occurs when the user clicks away from the calendar.

The On Updated event doesn't apply to the calendar control in Access 97 or later, it is used for OLE controls that contain data.
Best wishes,
Hans

Pat
5StarLounger
Posts: 1148
Joined: 08 Feb 2010, 21:27

Re: cannot change controls on form or subform

Post by Pat »

Thank you for that explanation, i figured i was right on the On Exit, wasn't at all sure about the On Updated though.

By the way, i found what was wrong, it now works beautifully. Thank you for your patience.