Form Record Source Not Updating

masterdineen

New member
Local time
Today, 07:55
Joined
Jul 25, 2012
Messages
9
Hello there.

I want to open a form and change the Record Source via a dynamic variable.

Code:
 Dim Table as String
  
 Table = "Statistics"+replace(Environ("Username"),".","")
  
 DoCmd.OpenForm "FrmStats", acNormal, , , , acHidden
  
 Form!FrmStats.RecordSource = Table
  
 DoCmd.Close acForm, "FrmStats", acSaveYes
When I go back into the FrmStats form and have a look at the RecordSource property, I can see that it has not changed.

Can someone point me in the right direction please. This doesn't seem like a hard task.

Regards

Rob
 
Why are making more work?
Set the form property to the query source.
No vba needed. It always works.
 
I will have multiple users on this Form and so I need to refresh each instance to a new table dynamically
 
This form should set its own recordsource, like...
Code:
private sub form_open(cancel as integer)
   me.recordsource = "Statistics"+replace(Environ("Username"),".","")
end sub
 

Users who are viewing this thread

Back
Top Bottom