Permanently Set RecordSource Property in Design Mode -- Access Crashes

ScriptMaster

New member
Local time
Today, 21:11
Joined
Mar 28, 2007
Messages
2
Hi Experts,

I have hundreds of Forms/Reports that needs each of their RecordSource property to be set (They were lost somehow when some import was done long time ago). But luckily I have the list of RecordSource values for all of these in a text file pulled from a documentation that was did earlier.

Now that I have these values, I'm finding it a pain to open up each form/report one by one and set the RecordSource property. I wrote a small module to take care of this programmatically ( I used regular expressions elsewhere, build the list and converted them into a Collection object in Access ).

Given this the scenario, here is my question: "How would you make a permanent change to the RecordSource property of a form/report, just like we do manually?"

Here is what I already tried without any success:

  1. I simply tried Form_MyFormName.RecordSource = "MyNewRecordSource" - didn't make any permanent impact.
  2. I tried the following code:
    Code:
    ...
    DoCmd.OpenForm frmName, acDesign ' , , , acFormPropertySettings
    
    '
    Debug.Print Forms.Item(frmName).RecordSource ' Prints Query1
    
    'Attempt to change the RecordSource property
    Forms.Item(frmName).RecordSource = "Query2" ' Access crashes when it executes this line
    ...

I use MS Access 2003 Professional Edition (build 11.5614.5606) running WinXP Pro SP2 with a normal Developer machine configuration.

Anyone ran into a similar problem? Is there a way to prevent this crash or a better approach to resolve this?

I greatly appreciate any valid pointers.

A few words on my background: I'm a C#, VB(6)/VBA programmer with a strong technical background. I'm a little new to MS Access but I see most of the things to be simple with a few exceptions like this -- I desperately need help!

Thanks a bunch in advance for your quick response.

Neo
 

Users who are viewing this thread

Back
Top Bottom