Floating Subform

  • Thread starter Thread starter DS
  • Start date Start date
D

DS

Anyone know how to do a floating subform? I havea main form with a
subform this works fine, but I don't want the subform on that form I
want it on another form that will be hidden and I will call it into view
as I need it. I'm having a problem adding records to this subform. Any
suggestion I would appreciate.
Thanks
DS
 
DS said:
Anyone know how to do a floating subform? I havea main form with a
subform this works fine, but I don't want the subform on that form I
want it on another form that will be hidden and I will call it into view
as I need it. I'm having a problem adding records to this subform.


A form can be displayed in a subform control, which must be
on a form. It can not be displayed independently of the
main form.

If I understand what you mean by "free floating", you will
need to use another form, not a subform. This means that
you will have to use additional code to coordinate the two
forms, similar to what the Link Mastr/Child properties do
for a subform.
 
Marshall said:
DS wrote:





A form can be displayed in a subform control, which must be
on a form. It can not be displayed independently of the
main form.

If I understand what you mean by "free floating", you will
need to use another form, not a subform. This means that
you will have to use additional code to coordinate the two
forms, similar to what the Link Mastr/Child properties do
for a subform.
Thanks Marshall, I got the SubForm for lack of a better word to open I
even was able to add a record....well almost, when I go to save it won't
let me, it says hat a record is required for the main form, so I made
another Subform but with a Main form this time and the same thin
happened. I just want to add a record from a list box on one form to
the subform on another form. I either can't get the focus on the
subform to add a new record or I can't save it.
Thanks
DS
 
DS said:
Thanks Marshall, I got the SubForm for lack of a better word to open I
even was able to add a record....well almost, when I go to save it won't
let me, it says hat a record is required for the main form, so I made
another Subform but with a Main form this time and the same thin
happened. I just want to add a record from a list box on one form to
the subform on another form. I either can't get the focus on the
subform to add a new record or I can't save it.


When doing this with a separate form, you not only have to
emulate the Link Master/Child properties, but you have to do
all the other things a main form - subform structure takes
care of for you.

One of those things is that the current record in either
form must be saved whenever the focus is moved to the other
form. (This may be your current problem).

Another is that the second form needs to retrieve the
promary key field from the first form so it can plug it into
the second form's foreign key field.

Yet another is the the second form needs to have its record
source property refiltered every time the first form
navigates to a different record (or when it is made
visible).

There may be additional coordination required, but that's
all I can think of at the moment.

Are you sure you want to go through all this?
 
Marshall said:
When doing this with a separate form, you not only have to
emulate the Link Master/Child properties, but you have to do
all the other things a main form - subform structure takes
care of for you.

One of those things is that the current record in either
form must be saved whenever the focus is moved to the other
form. (This may be your current problem).

Another is that the second form needs to retrieve the
promary key field from the first form so it can plug it into
the second form's foreign key field.

Yet another is the the second form needs to have its record
source property refiltered every time the first form
navigates to a different record (or when it is made
visible).

There may be additional coordination required, but that's
all I can think of at the moment.

Are you sure you want to go through all this?
Thanks Marshall,
I think I kinda need to go through all of this. It a big "Bell and
Whistle"!
Thanks
DS
PS I'll let you know my progress.
DS
 
DS said:
Thanks Marshall,
I think I kinda need to go through all of this. It a big "Bell and
Whistle"!
PS I'll let you know my progress.


OK, but If you hit a road block, be sure to post a new
question. It's a lot easier for folks to provide a specific
answer when you ask a specific question.
 
Marshall said:
DS wrote:





OK, but If you hit a road block, be sure to post a new
question. It's a lot easier for folks to provide a specific
answer when you ask a specific question.
Thanks Marshall, got it working, only one problem. How do you refilter
an open form?
Thanks
DS
 
DS said:
Thanks Marshall, got it working, only one problem. How do you refilter
an open form?


There's the Filter property:
Forms!otherform.Filter = "IDfield =" & Me.ID
Forms!otherform.FilterOn = True
But, the Filter property has unexpected side effects in some
circumstances.

If that produces any weird behavior, use the old reliable
technique of resetting the RecordSource property:
Forms!otherform.RecordSource = _
"SELECT <fieldlist> FROM thetable " & _
"WHERE IDfield =" & Me.ID
 
Marshall said:
DS wrote:





There's the Filter property:
Forms!otherform.Filter = "IDfield =" & Me.ID
Forms!otherform.FilterOn = True
But, the Filter property has unexpected side effects in some
circumstances.

If that produces any weird behavior, use the old reliable
technique of resetting the RecordSource property:
Forms!otherform.RecordSource = _
"SELECT <fieldlist> FROM thetable " & _
"WHERE IDfield =" & Me.ID
Thanks Marshall, I'll give this a shot. While I'm at it. The form that
contains the info is to be hidden, but when I do this the popup form
does seem to sync with the hidden form, it's one record behind. However
when I unhide the form everythig works fine, how can I make this work
with the form hidden?
Thanks
DS
 
DS said:
Thanks Marshall, I'll give this a shot. While I'm at it. The form that
contains the info is to be hidden, but when I do this the popup form
does seem to sync with the hidden form, it's one record behind. However
when I unhide the form everythig works fine, how can I make this work
with the form hidden?


What are you doing to "sync" the "popup" form the the "data"
form?

If you're using the OpenForm method's WhereCondition
argument, be aware that this only works if the "popup" form
is not already open.
 
Marshall said:
What are you doing to "sync" the "popup" form the the "data"
form?

If you're using the OpenForm method's WhereCondition
argument, be aware that this only works if the "popup" form
is not already open.
I'm syncing it from a Query.
Forms!PrepSlipSub!SalesID "HiddenForm"

If I close and reopen the popup then I see the new record otherwise I'm
one behind.
Thanks
DS
 
DS said:
I'm syncing it from a Query.
Forms!PrepSlipSub!SalesID "HiddenForm"

If I close and reopen the popup then I see the new record otherwise I'm
one behind.


Ahh, you're using a parameter in the popup's RecordSource
query. In this case, you have to Requery the popup be fore
you make it visible.
 
Back
Top