access2007 :RecordSource in VBA code ,not Properties ?

MartinThe11th

New member
Local time
Today, 05:29
Joined
Nov 13, 2009
Messages
9
The RecordSource on this form is set in VBA code and not in the Properties window.


i was trying to implement a code i found on the web with an example

database showing what i am trying to achieve .

it's an easy example showing how to retrieve data in a subform based on

a combo box in the main form ; ( form / subform ) .


when ever I rename the subform , change all the related info (in

properties / vb code )

a problem shows up in the line shown in red .


Code:
Sub SetFilter()
    Dim LSQL  As String
    
    LSQL = "select * from Customers"
    LSQL = LSQL & " where CustomerID = '" & cboSelected & "'"
    
    [COLOR=red]Form_frmCustomers_sub.RecordSource[/COLOR] = LSQL    
    
End Sub


for some reason the "RecordSource" is not showing anymore .

when i went back to the example .. i found the following note :

The RecordSource on this form is set in VBA code and not in the Properties window.


which i think is what causing the problem ...

but frankly , i didn't know what does it mean when " the record source is set in vba NOT properties window " ..




any idea where i messed up !?

help is appreciated ..

access 2007
 
I believe this link should help you with the syntax.

Mmm,... you think it's a refrencing issue !?

i highly doubt it .. but i wil check that

thank you for your input ..
 
You need to set the RecordSource of the SubForm and not the SubFormControl.
 

Users who are viewing this thread

Back
Top Bottom