I have a simple task giving me a lot of trouble.
What I need is to simply move a variable from my VBA macro to a function, to be able to use it in an Access Query.
ADDED: I have created a small and simple access document with a simple VBA. Download it at: http://sharesend.com/olpy1o7d
If someone could be kind to download and see what I am doing wrong, I would really prefer it.
In the form f_main
I need to be able to change counter
to whatever number and hence get an updated query when the button is pressed in the main form.
It is described below, but downloading it may explain my situation easier.
EDITED:
Public counter as Integer
Private Sub Command_Click()
counter = 1
End Sub
And in a module:
Public Function n()
n = counter
End Function
In access, I have a SQL Query as:
SELECT t_Data.ID, n() AS Expr1 FROM t_Data;
Access says it can not find the function n()
If i use the function builder, i can see n(), so i guess it is because the function n() is empty - It can not find "counter" declared in my form.
What can i do?
binsize
come into play here? Or the kW? How is theSELECT
statement called? And why does it need a column with the value of the counter? How are the queriesq_PowerBinned_0x
defined? – Ansgar WiechersModule
, not aClass Module
for a Form or Report. – Gord Thompson