From: John W. Vinson on
On Wed, 5 May 2010 19:35:01 -0700, D. Stacy
<david_d_stacy(a)msn.com.(remove_this_part).> wrote:

>Now I need to to just get the txt box to refresh after each change of the
>combo box.

Requery the textbox in the AfterUpdate event of the combo.
--

John W. Vinson [MVP]
From: Jeanette Cunningham on
Try using Me.Recalc in the after update of the combo.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

"D. Stacy" <david_d_stacy(a)msn.com.(remove_this_part).> wrote in message
news:FB92BB87-A98F-42D3-8B46-ACAF876745E4(a)microsoft.com...
>I got that issue resolved (typing problem!).
>
> Now I need to to just get the txt box to refresh after each change of the
> combo box.
>
>
>
> "D. Stacy" wrote:
>
>> Hi Jeanette,
>> I entered that into the control source property and that produces the
>> #Name?
>> error.
>>
>>
>>
>> "Jeanette Cunningham" wrote:
>>
>> > Stacy,
>> > just use the public function you created earlier, and importantly, you
>> > need
>> > to tell it what value to use for lCriteria.
>> >
>> >
>> > =FindGPCI_Work(Me!txtLocality_ID)
>> >
>> > The above is what goes in the control source for the textbox.
>> >
>> >
>> > Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
>> >
>> > "D. Stacy" <david_d_stacy(a)msn.com.(remove_this_part).> wrote in message
>> > news:CA4E119A-7936-4F38-829A-1A8129F7305C(a)microsoft.com...
>> > > Have public function (loaded in the global module) that produces a
>> > > variable
>> > > as a double.
>> > >
>> > > That all works fine as evidenced by the debug.print method in the
>> > > immediate
>> > > window.
>> > >
>> > > I desire to have the current value of the variable displayed in a
>> > > text
>> > > box.
>> > >
>> > > I created a callback function (loaded in global module) that looks
>> > > like:
>> > >
>> > > Public Function GetCurrentWork_GPCI() As Double
>> > > Dim CurrentWork_GPCI As Double
>> > >
>> > > GetCurrentWork_GPCI = CurrentWork_GPCI
>> > >
>> > > End Function
>> > >
>> > >
>> > > I can't figure out how to make it display; I've currently got the
>> > > control
>> > > source property set to =GetCurrentWork_GPCI(), but that just displays
>> > > a 0.
>> > >
>> > >
>> > > Please help!
>> > >
>> > >
>> > >
>> > >
>> >
>> >
>> >
>> > .
>> >


From: Stuart McCall on
"D. Stacy" <david_d_stacy(a)msn.com.(remove_this_part).> wrote in message
news:FB92BB87-A98F-42D3-8B46-ACAF876745E4(a)microsoft.com...
>I got that issue resolved (typing problem!).
>
> Now I need to to just get the txt box to refresh after each change of the
> combo box.

I suggest 'pushing' the value into the textbox from the combo, rather than
using an expression in the textbox's controlsource to 'pull' the value (I
think this is what John V meant). Try blanking the textbox's controlsource
and put this code in the combo's AfterUpdate event:

Me!TextboxName = FindGPCI_Work(Me!txtLocality_ID)


From: Marshall Barton on
D. Stacy <david_d_stacy(a)msn.com.(remove_this_part).> wrote:

>Have public function (loaded in the global module) that produces a variable
>as a double.
>
>That all works fine as evidenced by the debug.print method in the immediate
>window.
>
>I desire to have the current value of the variable displayed in a text box.
>
>I created a callback function (loaded in global module) that looks like:
>
>Public Function GetCurrentWork_GPCI() As Double
> Dim CurrentWork_GPCI As Double
>
> GetCurrentWork_GPCI = CurrentWork_GPCI
>
>End Function
>
>
>I can't figure out how to make it display; I've currently got the control
>source property set to =GetCurrentWork_GPCI(), but that just displays a 0.


Since the variable returned by the function is local to the
function and never set by the function, its initial value,
which is 0, is all the function can ever return.

Where does your original function that "produces a variable
as a double" store that variable's value. For your two
functions to work together, the varaible must be declared in
a place that is available to both functions. Assuming both
functions are in the same module, the variable needs to be
declared in the module's deckarations section (at the top of
the module, before any Sub or Function statements):

Private CurrentWork_GPCI As Double
. . .
Public Function SetCurrentWork_GPCI()(...
, , ,
CurrentWork_GPCI = something
End Function

Public Function GetCurrentWork_GPCI() As Double
GetCurrentWork_GPCI = CurrentWork_GPCI
End Function

--
Marsh
MVP [MS Access]