Remove Record and Control Source

Exodus

Registered User.
Local time
Today, 11:19
Joined
Dec 4, 2003
Messages
317
How to prgramaticly remove the record source for a form. and the control source for the controls.
 
I tried that, but in the properties for the form it still shows the record source.
 
It still shows the original record source in the properties box when you look at it in the design view but the actual record source of the form will be empty once you execute the code in your form with an event [OnClick]. If you save the form when it is closed the record source will [should] be empty.

Code:
DoCmd.Save 'will save the active object [not the current record]
 
Well Here is my Code. I call it on close of the form but it still doesn't work.

Code:
Me.PollingPlacesResults.Form.RecordSource = ""
Me!PollingPlacesResults!PollID.ControlSource = ""
Me!PollingPlacesResults!location_line_1.ControlSource = ""
Me!PollingPlacesResults!location_line_2.ControlSource = ""
Me!PollingPlacesResults!city.ControlSource = ""
Me.PollingPlacesResults2.Form.RecordSource = ""
Me!PollingPlacesResults2!PollID.ControlSource = ""
Me!PollingPlacesResults2!location_line_1.ControlSource = ""
Me!PollingPlacesResults2!location_line_2.ControlSource = ""
Me!PollingPlacesResults2!city.ControlSource = ""
DoCmd.Save
 
Your right it won't work in the OnClose event of the form. This will work in the forms OnLoad event...

Code:
Private Sub Form_Load()
 
     Me.RecordSource = ""
 
End Sub
That will remove the record source for the form when it is opened.
 
Still not working.
My db is FE and BE the form I working with has sub forms which return results from criteria in the main form. I trying to have the subs and their controls unbound and set their record source via code on after update from the main forms search criteria. This works fine except for after a while Access starts actualy putting the record source and control source into the forms which then makes the form load up slower when multiple users are on.
 

Users who are viewing this thread

Back
Top Bottom