473,385 Members | 2,243 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

can you change to source object on subforms in code

I have a form that is broken down into 24 sub forms.
these are all tied to one subform, they are filtered based on other
things.

But I need to change the sub forms source object based on a selection.
I was going to try this..

For Each doc In dbs.Containers("Forms").Documents
frmname = doc.Name

If frmname = "DM hx1Mon" Then

DoCmd.OpenForm frmname, acDesign, , , , acHidden
For Each ctl In Forms(frmname).Controls
If ctl.ControlType = acSubform Then

For Each prp In ctl.Properties
Debug.Print "Just looking "&
prp.Name
Next

end if
next
End If

I can't find out exactly what I need to change.

just need to change "subfrm_drub_visit_1mon"
to "subfrm_drub_visit_3mon"
something like this
any pointers would be greatly appreciated
Mar 5 '07 #1
5 5825
On Mar 5, 10:41 am, sparks <jstal...@swbell.netwrote:
I have a form that is broken down into 24 sub forms.
these are all tied to one subform, they are filtered based on other
things.

But I need to change the sub forms source object based on a selection.
I was going to try this..

For Each doc In dbs.Containers("Forms").Documents
frmname = doc.Name

If frmname = "DM hx1Mon" Then

DoCmd.OpenForm frmname, acDesign, , , , acHidden
For Each ctl In Forms(frmname).Controls
If ctl.ControlType = acSubform Then

For Each prp In ctl.Properties
Debug.Print "Just looking "&
prp.Name
Next

end if
next
End If

I can't find out exactly what I need to change.

just need to change "subfrm_drub_visit_1mon"
to "subfrm_drub_visit_3mon"

something like this
any pointers would be greatly appreciated

The subform control contains the property you need to change.

Me!subFormControl.SourceObject="formName"

You may in some rare cases need to repaint the screen after changing
the object.
Me.Repaint

Mar 5 '07 #2
I went right past it..

THANKS BIG TIME for your help

(in my defense its monday) but isn't every day LOL
On 5 Mar 2007 08:00:28 -0800, "storrboy" <st******@sympatico.ca>
wrote:
>On Mar 5, 10:41 am, sparks <jstal...@swbell.netwrote:
>I have a form that is broken down into 24 sub forms.
these are all tied to one subform, they are filtered based on other
things.

But I need to change the sub forms source object based on a selection.
I was going to try this..

For Each doc In dbs.Containers("Forms").Documents
frmname = doc.Name

If frmname = "DM hx1Mon" Then

DoCmd.OpenForm frmname, acDesign, , , , acHidden
For Each ctl In Forms(frmname).Controls
If ctl.ControlType = acSubform Then

For Each prp In ctl.Properties
Debug.Print "Just looking "&
prp.Name
Next

end if
next
End If

I can't find out exactly what I need to change.

just need to change "subfrm_drub_visit_1mon"
to "subfrm_drub_visit_3mon"

something like this
any pointers would be greatly appreciated


The subform control contains the property you need to change.

Me!subFormControl.SourceObject="formName"

You may in some rare cases need to repaint the screen after changing
the object.
Me.Repaint
Mar 5 '07 #3
"sparks" <js******@swbell.netwrote in message
news:3s********************************@4ax.com...
>I went right past it..

THANKS BIG TIME for your help

(in my defense its monday) but isn't every day LOL
Just remember, you don't need, nor want to open the form in design
mode......

You can change this property at run time....
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl*****************@msn.com
Mar 5 '07 #4
what I am doing is taking a form that was designed for 1 time data
entry and converting it to many visits.
so a form that would be Baseline with 24 subforms called Base
will be a new form 1MonthVisit with 24 subforms called 1Month.
So I did it in place and making new forms and subforms.
So I did it this way, kinda worried that if I did it at run time
using one form and 1 subform...someone would make it mess up and then
the records would be a mess.
(the people around here have a way of screwing up a crowbar taking it
out of the box)
Its a pain in the you know what.
filters out the arse.

almost finished I hope.

On Mon, 05 Mar 2007 16:25:12 GMT, "Albert D. Kallal"
<Pl*******************@msn.comwrote:
>"sparks" <js******@swbell.netwrote in message
news:3s********************************@4ax.com.. .
>>I went right past it..

THANKS BIG TIME for your help

(in my defense its monday) but isn't every day LOL

Just remember, you don't need, nor want to open the form in design
mode......

You can change this property at run time....
Mar 5 '07 #5
On Mar 5, 1:11 pm, sparks <jstal...@swbell.netwrote:
what I am doing is taking a form that was designed for 1 time data
entry and converting it to many visits.
so a form that would be Baseline with 24 subforms called Base
will be a new form 1MonthVisit with 24 subforms called 1Month.
So I did it in place and making new forms and subforms.
So I did it this way, kinda worried that if I did it at run time
using one form and 1 subform...someone would make it mess up and then
the records would be a mess.
(the people around here have a way of screwing up a crowbar taking it
out of the box)
Its a pain in the you know what.
filters out the arse.

almost finished I hope.

On Mon, 05 Mar 2007 16:25:12 GMT, "Albert D. Kallal"

<PleaseNOOOsPAMmkal...@msn.comwrote:
"sparks" <jstal...@swbell.netwrote in message
news:3s********************************@4ax.com...
>I went right past it..
THANKS BIG TIME for your help
(in my defense its monday) but isn't every day LOL
Just remember, you don't need, nor want to open the form in design
mode......
You can change this property at run time....

I would think having one form for each day and a master for each month
would be the most cumbersome thing to administer. There has to be a
better way to organize the data so that you can minimize the number of
forms. Before you implement (or even continue with) this I would
seriously spend some time reaserching similar applications and re-
thinking the schema.
But in the end it's up to you and what's best for your task.

Mar 5 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Stewart Midwinter | last post by:
I've got an app that creates an object in its main class (it also creates a GUI). My problem is that I need to pass this object, a list, to a dialog that is implemented as a second class. I want...
0
by: Etienne Charland | last post by:
I have a DataSource and a DataMember (like with standard bindings). Now, I want to write a function that gets the source object from them. So, let's say DataSource is a dataset and DataMember is...
1
by: gsb | last post by:
Is it possible to change embedded object parameters via JavaScript on-the fly? Actually it is a Flash embedded object and I want to change the WMODE value on-the-fly. Is such a thing possible?...
3
by: Roman Gordin | last post by:
Hi, I use SVG for web-GUI, but found some serious restrictions 8-( When I use HTML (dynamically generated from .php), I may use HTTPRequest object to provide dynamically regeneration some part...
8
by: dixie | last post by:
I have a report with a subreport. The source object for this subreport varies according to the value of a field in a table. I am trying to programmatically set the object source for the subreport...
5
by: ad | last post by:
The Global.asax is code-inside with default. How to change Global.asax to code-behind?
13
by: frk.won | last post by:
I am interested in learning how to use the VS 2005 code snippets. However, I wish to know what are the best ways to source control the code snippets? Are there any source safe/subversion...
1
SamKL
by: SamKL | last post by:
Hey, I'm no expert on PHP, and I have somewhat of an understanding of object oriented code. Anyway, getting right to the problem. I'm using PHP4, so base it off of that. Basically I have 2...
9
whatelyb
by: whatelyb | last post by:
I am having trouble related to the attached coding. I am trying to make the object "flight1pic" change depending on what is selected in the drop down menus "airline1" and "aircraft1". My...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.