Changing record source of SubForm - Help

N

nxqviet

Hi all,

I need help in changing a record source of a sub form.

I used this code

========================Code====================
Dim varName As Variant
varName = SessionID.Value

Dim stRecordSourceSQL As String
stRecordSourceSQL = "SELECT [" & varName & "].ID, [" & varName
& "].ServiceName, [" & varName & "].Price FROM " & varName & ";"

Forms!frmAsgnPrice_EditPrices!frmAsgnPrice_EditPricesSubForm.Form.RecordSource
= stRecordSourceSQL

========================End=====================

The form containing this sub form is open when this code is executed.
It keep saying that "the Object is closed or Does not exist". How do I
change this?

Thanks,

V_
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top