J
JK
Hi to all,
I am struggling with 2 problems which I'm sure there are simple solutions to
them.
Question1
-----------
I'm trying to write a function which reads an object whereby the object name
and the field name are supplied parameters:
Public Function MyFunction(ValueX as variant, FieldName as ????, ObjectName
as string, optional ObjectType as Byte=acQuery) as variant
Dim X as Double, ......
Select Case ObjectType
.......
Case 1
DoCmd.OpenQuery ObjectName
.......
End Select
DoCmd.GoToRecord, ,acFirst
Do
'Read Filled "FieldName"
X= ?????? 'How do I do it ???? ********
...
DoCmd.GoToRecord, ,acNext
Loop
.............
..
End Function
I have no problem with forms, I use X= Forms(ObjectName)(FieldName) but I
am struggling with tables and queries, I'm looking for something like
&ObjectName in the good old dBase. I tried "[" & FieldName & "]" but it does
not work
How do I do it?
Question 2
-------------
How to I get out of the Do/Loop when I reach the last record in the above
example e.g:
Do While ?????
Regards/JK
I am struggling with 2 problems which I'm sure there are simple solutions to
them.
Question1
-----------
I'm trying to write a function which reads an object whereby the object name
and the field name are supplied parameters:
Public Function MyFunction(ValueX as variant, FieldName as ????, ObjectName
as string, optional ObjectType as Byte=acQuery) as variant
Dim X as Double, ......
Select Case ObjectType
.......
Case 1
DoCmd.OpenQuery ObjectName
.......
End Select
DoCmd.GoToRecord, ,acFirst
Do
'Read Filled "FieldName"
X= ?????? 'How do I do it ???? ********
...
DoCmd.GoToRecord, ,acNext
Loop
.............
..
End Function
I have no problem with forms, I use X= Forms(ObjectName)(FieldName) but I
am struggling with tables and queries, I'm looking for something like
&ObjectName in the good old dBase. I tried "[" & FieldName & "]" but it does
not work
How do I do it?
Question 2
-------------
How to I get out of the Do/Loop when I reach the last record in the above
example e.g:
Do While ?????
Regards/JK