reference form for update variable

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have several similar forms with a common field: GISIndx.

From each of these forms I want to execute a macro that runs a query used to
update a field in a table to equal the GISIndx value.

I want to use the same query without regard to the form that is open, but
unless I am having trouble as the query stops and asks for the input value
that should be picked up from the form.

Is there a generic reference for that variable expression in the update
field of the query that will point to the GISIndx value on the active form
and what does it look like?
 
Hi,



Use a function in a standard module (not in a form, report or other
class).


Public Function MyParam( ControlName As String ) As Variant
Dim f as Form
f=Screen.ActiveForm
MyParam=f.Controls( ControlName )
End Function


And in the query, use:


SELECT ... WHERE myField = MyParam("Text0")


as example.


Hoping it may help,
Vanderghast, Access MVP
 

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

Back
Top