Hi Kevin,
This line:
Dim frm As New Form_fzzDBCompare
Creates a *new* instance of the form named 'fzzDBCompare'. So if Form A is
actually 'fzzDBCompare' then what you have is:
FormA ->> FormB->> FormA(1)
The procedure that was called made changes to the new instance and then as
soon as you set frm=Nothing, the new instance 'FormA(1)' is closed and
cleared from memory. So your call worked, it just created no visible or
usable results. There are times when it is nice to know how to instantiate a
new copy of a form - if you want the full explanation let me know and I'll
give you all the details.
Here's how to reference the current instance - you don't really need the
form variable but I'll show it both ways:
Dim frm As form
set frm = forms!fzzDBCompare
frm.StuffID tFromOrTo, Me.tDBID & ""
Set frm = Nothing
Without the form variable:
forms!fzzdbCompare..StuffID tFromOrTo, Me.tDBID & ""
--
Sandra Daigle [Microsoft Access MVP]
Please post all replies to the newsgroup.
Kevin said:
Hi, Sandra. Thanks for the help.
I'm trying to update a combo box in a form (Form A) based on data
keyed into another form (Form B). Form B is opened on a button click
fom Form A.
Here's the code in Form B:
Dim frm As New Form_fzzDBCompare
frm.StuffID tFromOrTo, Me.tDBID & ""
Set frm = Nothing
And in the form A:
Public Sub StuffID(tFromOrTo As String, IDToStuff As String)
If tFromOrTo = "From" Then
Me.tFromDBId = IDToStuff
tFromDBId_BeforeUpdate 0
tFromDBId_AfterUpdate
Else
Me.tToDBId = IDToStuff
tToDBId_BeforeUpdate 0
tToDBId_AfterUpdate
End If
Me.Refresh
End Sub
If I step through the code I can see the Form A code executing, but it
doesn't update the combo box (Me.tFromDBId or me.tToDBId).
What am I doing wrong?
Kevin
Sandra Daigle said:
Hi Kevin,
Post your code - both the public event in the form you are trying
to call and the calling code in the other form/module. Also, have
you tried stepping through the code? If so, what happens? Are you
getting errors when you try to compile?
--
Sandra Daigle
[Microsoft Access MVP]
For the benefit of others please post all replies to this newsgroup.
Kevin Witty wrote:
Hi, Sandra -
I know the original message is old, but I hope someone is watching.
I tried your solution, and it didn't work for me. It simply doesn't
execute. (Access 2003 vba.) I've tried all kinds of different
syntax to try to do this, and I can't make it work.
???
Thanks,
Kevin
:
Yes it is possible. Just make the procedure a Public procedure and
then you call it as a method of the form:
Forms!formA.MyProcedure
--
Sandra Daigle [Microsoft Access MVP]
Please post all replies to the newsgroup.
prhood wrote:
I would like to invoke a procedure in Form A (modal and open) from
Form B (also modal and open). The procedure would cause a change
in the data displayed on form A. Is this possible? and what is the
correct syntax to use?