Changing a forms properties under program control

R

Ray C

I have a form caled "frm _Main" and that form has a Sub Form called
"frm_Sub_Address" embeded in it. I am wanting to make the "frm_Sub_Address"
get its information from two different Tables depending on what info the user
wants. The two Tables are called "tbl_Stores" and "tbl_Suppliers". I know
that you will raise the question, why do I have 2 tables containing Adddress
info but putting that pointy to one side for the moment, my code is as
follows, depending on what info the user wants :-

iF user wants this info
Forms.frm_main.RecordSource = "tbl_Store"
frm_Sub_Right.SourceObject = "frm_Sub_Address"
*** Forms.frm_Sub_Address.RecordSource = "tbl_store"
frm_Sub_Right.LinkChildFields = "AddrID"
frm_Sub_Right.LinkMasterFields = "AddrID"

ElseIf usr wants this info
Forms.frm_main.RecordSource = "tbl_Suppliers"
frm_Sub_Right.SourceObject = "frm_Sub_Address"
*** Forms.frm_Sub_Address.RecordSource = "tbl_suppliers"
frm_Sub_Right.LinkChildFields = "SupplierNo"
frm_Sub_Right.LinkMasterFields = "SupplierNo"

The lines marked with an asterisk produce the following Run time error 438
Object does not support this property or method

Whereas, if I change the lined to read - frm_Sub_Address.RecordSource =
"tbl_suppliers, I get Run time error 424 Object required.

The idea is that I change the properties of both the Main Form and the Sub
form so that a selection on the main for will fill the records in the Sub
form.

Anyone able to help please?

thanks Ray C
 
R

Ray C

Thanks Benjamin, could you possibly help me a little further with the syntax?
I assume that I need to insert the sub form name ("frm_Sub_Address") in there
somewhere but I keep on getting error 424 Object required no matter how I
change things round.

Thanks for the response and sorry to be a pain.

Regards Ray C
 

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