[AccessD] Cannot set recordsource on Load Event

Randall Anthony randall.anthony at cox.net
Sat Jan 26 15:11:55 CST 2008


I sorry I didn't make myself clear.  I have also just placed a line of code
in the OpenForm event Me.Recordsource = "Audit_Data_Med" and it still
returns all records.  

Could setting the criteria be the problem?  That I can't apply a filter to
the form while dynamically setting the recordsource?

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Steve Schapel
Sent: Saturday, January 26, 2008 3:36 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Cannot set recordsource on Load Event

Randall,

I would always use the Open event of the form, rather than the Load 
event, to manipulate the Record Source.  Not sure whether that will make 
a difference, but waiting until after the data is populated seems a bit 
late in the day to be telling it which records to include.

The OpenArgs property is text, not numerical.  Therefore, your code 
should read:

Private Sub Form_Open(Cancel As Integer)
     If Me.OpenArgs = "1"
         Me.RecordSource = "Audit_Data_Med"
     Else
        Me.RecordSource = "Audit_Data_MH"
     End If
End Sub

Randall Anthony wrote:
> So, setting the recordsource (no matter where) triggers the oncurrent?
> Therefore bypassing the set criteria?
-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list