run afterupdate procedure from a different form

  • Thread starter ragtopcaddy via AccessMonster.com
  • Start date
R

ragtopcaddy via AccessMonster.com

I have a form that re-writes it's own RecordSource querydef in the after
update procs of 4 combo boxes. This is a very effective method for "zeroing
in" on a particular record based on those selections. What I am trying to do
now is to open this form(A) from another form(B), and use criteria gathered
on B to update the contents of the combo boxes on A. However, I am unable to
get the after update proc ("setQDF"), which is in the form class module of A,
to run. How do I do this?

Thanks

Bill R

--
Bill Reed

"If you can't laugh at yourself, laugh at somebody else"

Message posted via AccessMonster.com
 
M

Marshall Barton

ragtopcaddy said:
I have a form that re-writes it's own RecordSource querydef in the after
update procs of 4 combo boxes. This is a very effective method for "zeroing
in" on a particular record based on those selections. What I am trying to do
now is to open this form(A) from another form(B), and use criteria gathered
on B to update the contents of the combo boxes on A. However, I am unable to
get the after update proc ("setQDF"), which is in the form class module of A,
to run. How do I do this?


Make the procedure Public. Then, as long as form A is open,
you can call it using this kind of syntax:

Forms![Form A].setQDF
 
R

ragtopcaddy via AccessMonster.com

Marshall,

Thanks for pointing me in the right direction. "Public" did the trick. Here's
the code I ended up with (which works like a charm!):

DoCmd.OpenForm "A"
Set frm = Forms("A")

With frm
.Controls("cmbAssetTypes") = Me.ASTPID
.Controls("cmbWAL") = Me.WAL
.Controls("cmbRating") = Me.RTGID
.Controls("grpFloat") = Me.Float
.setQDF
End With


Marshall said:
I have a form that re-writes it's own RecordSource querydef in the after
update procs of 4 combo boxes. This is a very effective method for "zeroing
[quoted text clipped - 3 lines]
get the after update proc ("setQDF"), which is in the form class module of A,
to run. How do I do this?

Make the procedure Public. Then, as long as form A is open,
you can call it using this kind of syntax:

Forms![Form A].setQDF
 
R

ragtopcaddy via AccessMonster.com

Marshall,

In the same scenario:

From form B, how do I get a value in the 3rd field of a combo box on form A?

Thanks,

Bill R

Marshall said:
I have a form that re-writes it's own RecordSource querydef in the after
update procs of 4 combo boxes. This is a very effective method for "zeroing
[quoted text clipped - 3 lines]
get the after update proc ("setQDF"), which is in the form class module of A,
to run. How do I do this?

Make the procedure Public. Then, as long as form A is open,
you can call it using this kind of syntax:

Forms![Form A].setQDF

--
Bill Reed

"If you can't laugh at yourself, laugh at somebody else"

Message posted via AccessMonster.com
 
R

ragtopcaddy via AccessMonster.com

I'm afraid my last question is a little muddy. To clarify:

The row source of a combo box on form "A" has 3 fields, the 1st a hidden ID,
the 2nd a visible text value, the 3rd a parent key (ID).

I want to get this parent key in my form "B" procedure, and use it to update
an additional combo box on form "A"

I hope that's a little clearer.

Bill R

Marshall said:
I have a form that re-writes it's own RecordSource querydef in the after
update procs of 4 combo boxes. This is a very effective method for "zeroing
[quoted text clipped - 3 lines]
get the after update proc ("setQDF"), which is in the form class module of A,
to run. How do I do this?

Make the procedure Public. Then, as long as form A is open,
you can call it using this kind of syntax:

Forms![Form A].setQDF

--
Bill Reed

"If you can't laugh at yourself, laugh at somebody else"

Message posted via AccessMonster.com
 
M

Marshall Barton

You can get to any column (and row) in a combo/list box's
RowSource by using the Column property (read only):

x = .combobox.Column(2) 'third column
--
Marsh
MVP [MS Access]

I'm afraid my last question is a little muddy. To clarify:

The row source of a combo box on form "A" has 3 fields, the 1st a hidden ID,
the 2nd a visible text value, the 3rd a parent key (ID).

I want to get this parent key in my form "B" procedure, and use it to update
an additional combo box on form "A"

I hope that's a little clearer.

Bill R

Marshall said:
I have a form that re-writes it's own RecordSource querydef in the after
update procs of 4 combo boxes. This is a very effective method for "zeroing
[quoted text clipped - 3 lines]
get the after update proc ("setQDF"), which is in the form class module of A,
to run. How do I do this?

Make the procedure Public. Then, as long as form A is open,
you can call it using this kind of syntax:

Forms![Form A].setQDF
 
R

ragtopcaddy via AccessMonster.com

Thanks Marshall,

That's what I was doing, but it kept crapping out. I determined that the
problem was there was no 3rd column. I had added it in the existing query for
the combo box, but had forgotten that the query for that box gets re-written
in code whenever the form opens or changes are made to a dependent combo box.


Your advice forced me to look elsewhere for the solution and I was able to
find it.

Thanks again,

Bill R

Marshall said:
You can get to any column (and row) in a combo/list box's
RowSource by using the Column property (read only):

x = .combobox.Column(2) 'third column
I'm afraid my last question is a little muddy. To clarify:
[quoted text clipped - 18 lines]
Forms![Form A].setQDF
 
M

Marshall Barton

Kind of the long way around to find a problem ;-)

Glad to hear it's solved
--
Marsh
MVP [MS Access]

Thanks Marshall,

That's what I was doing, but it kept crapping out. I determined that the
problem was there was no 3rd column. I had added it in the existing query for
the combo box, but had forgotten that the query for that box gets re-written
in code whenever the form opens or changes are made to a dependent combo box.


Your advice forced me to look elsewhere for the solution and I was able to
find it.

Thanks again,

Bill R

Marshall said:
You can get to any column (and row) in a combo/list box's
RowSource by using the Column property (read only):

x = .combobox.Column(2) 'third column
I'm afraid my last question is a little muddy. To clarify:
[quoted text clipped - 18 lines]
Forms![Form A].setQDF
 

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