How to define parameters

  • Thread starter Thread starter Luka
  • Start date Start date
L

Luka

Hello,
I have problem with defining Labels Names in MyReport.
There is MyReport with a lot of Labels with Names:
ZNAK1, Datum1, Pos1, IME1
ZNAK2, Datum2, Pos2, IME2
ZNAK3, Datum3, Pos3, IME3
and so on
I created Function SPREMEMBE (ZNAK, Datum, Pos, IME) to be
called many times from Function aa() with different
parameters-representing Label Names.
I want parameters (ZNAK, Datum, Pos, IME) to be used as
Label Names in MyReport. But I do not know how to define
Type of parameter (or how to Set it), to be understood as
Name of Label in MyReport.
Code as follow get Error MsgBox that Report!LabelName is
not recognized-does not exist.
Please help.

Global MyForm As Form
Global MyReport As Report
-----------------------------------------------------------
Function aa()

Set MyForm = New [Form_Some Form]
MyForm.Caption = "KEY"
MyForm.RecordSource = "Query......"
MyForm.Visible = True

DoCmd.OpenReport "Some_Report", acPreview, "", ""
Set MyReport = Reports![ Some_Report ]

SPREMEMBA "ZNAK1", "Datum1", "Poz1", "IME1" 'Params as
strings!?
'After additional procedure-next calling
SPREMEMBA "ZNAK2", "Datum2", "Poz2", "IME2"
SPREMEMBA "ZNAK3", "Datum3", "Poz3", "IME3"
|
|
'and so on

End Function
----------------------------------------------------------
Function SPREMEMBA (ZNAK, Datum, Poz, IME)

MyReport!ZNAK.Visible = True 'HERE ERROR OCCURES
MyReport!ZNAK.Caption = Left(MyForm!Opomba, InStr(MyForm!
Opomba, "$") - 1)
MyReport!Datum.Visible = True
MyReport!Datum.Caption = MyForm!Datum
MyReport!Poz.Visible = True
MyReport!Poz.Caption = Right(MyForm!Opomba, Len(MyForm!
Opomba) - InStr(MyForm!Opomba, "$"))

If ((MyForm!IME) Like "AAA*") Then
MyReport!IME.Caption = "AAAAAAAA"
Exit Function
End If
If ((MyForm!IME) Like "BBB*") Then
MyReport!IME.Caption = "BBBBBBB"
Exit Function
End If
End Function
 
Luka said:
I have problem with defining Labels Names in MyReport.
There is MyReport with a lot of Labels with Names:
ZNAK1, Datum1, Pos1, IME1
ZNAK2, Datum2, Pos2, IME2
ZNAK3, Datum3, Pos3, IME3
and so on
I created Function SPREMEMBE (ZNAK, Datum, Pos, IME) to be
called many times from Function aa() with different
parameters-representing Label Names.
I want parameters (ZNAK, Datum, Pos, IME) to be used as
Label Names in MyReport. But I do not know how to define
Type of parameter (or how to Set it), to be understood as
Name of Label in MyReport.
Code as follow get Error MsgBox that Report!LabelName is
not recognized-does not exist.
Please help.

Global MyForm As Form
Global MyReport As Report
-----------------------------------------------------------
Function aa()

Set MyForm = New [Form_Some Form]
MyForm.Caption = "KEY"
MyForm.RecordSource = "Query......"
MyForm.Visible = True

DoCmd.OpenReport "Some_Report", acPreview, "", ""
Set MyReport = Reports![ Some_Report ]

SPREMEMBA "ZNAK1", "Datum1", "Poz1", "IME1" 'Params as
strings!?
'After additional procedure-next calling
SPREMEMBA "ZNAK2", "Datum2", "Poz2", "IME2"
SPREMEMBA "ZNAK3", "Datum3", "Poz3", "IME3"
'and so on

End Function
----------------------------------------------------------
Function SPREMEMBA (ZNAK, Datum, Poz, IME)

MyReport!ZNAK.Visible = True 'HERE ERROR OCCURES
MyReport!ZNAK.Caption = Left(MyForm!Opomba, InStr(MyForm!
Opomba, "$") - 1)
MyReport!Datum.Visible = True
MyReport!Datum.Caption = MyForm!Datum
MyReport!Poz.Visible = True
MyReport!Poz.Caption = Right(MyForm!Opomba, Len(MyForm!
Opomba) - InStr(MyForm!Opomba, "$"))

If ((MyForm!IME) Like "AAA*") Then
MyReport!IME.Caption = "AAAAAAAA"
Exit Function
End If
If ((MyForm!IME) Like "BBB*") Then
MyReport!IME.Caption = "BBBBBBB"
Exit Function
End If
End Function

To reference controls when you have their name in a string
variable, you need to use this syntax:

MyReport(ZNAK).Visible = True
MyReport(Datum).Caption = MyForm(Datum)
MyReport(Poz).Visible = True
etc.

The syntax you used requires the actual name of the control
following the !
 
Marsh,
Thank you very much for your answer. This is what I want.

By the way, I'd like you to pay attention to the address
written below your RE.
I am strongly convinced this is a fake address, hiding
viruses of type I-Worm.
I have already fallen into a trap once before.
Let your experts check it.

With kind regards Luka
 
Luka said:
Marsh,
Thank you very much for your answer. This is what I want.

Nice get it right once in a while ;-)

By the way, I'd like you to pay attention to the address
written below your RE.

What address are you referring to?
I am strongly convinced this is a fake address, hiding
viruses of type I-Worm.
I have already fallen into a trap once before.
Let your experts check it.

I am my own expert??
 
What address are you referring to?

Marsh,
I mean the adress written on the last position of the tree-
under my question and your replay to me.

Subject:
MS Jet Service Pack 8 Released
with text as follow:

For all Access 2000 / 2002 (Xp) and 2003 users, MS has
released Jet Service
Pack 8. You'll find it by going to the Windows Update web

http://v4.windowsupdate.microsoft.com

Luka
 
Marsh,
I mean the adress written on the last position of the tree-
under my question and your replay to me.

Subject:
MS Jet Service Pack 8 Released
with text as follow:

For all Access 2000 / 2002 (Xp) and 2003 users, MS has
released Jet Service
Pack 8. You'll find it by going to the Windows Update web

http://v4.windowsupdate.microsoft.com

When I go to that site, it offers to scan my system for
needed critical updates. I don't see any tree, much less
your question or a reply from me. I still have no idea what
address you're referring to.

According to my email/newsgroups program (Agent), I can see
nothing wrong with the addresses in this thread. It sounds
like you might be using a web interface to the newsgroups
and seeing something very different from what I see.
 
Marsh

I went to the site
(http://v4.windowsupdate.microsoft.com) from our official
business computer, and Wizard appeared. There is the
massage that authenticity is checked by Microsoft Code
Signing PCA. It seems OK.
Perhaps I was concerned too soon. I apology.
I was suspicious because Microsoft Windows Update Form
that (http://v4.windowsupdate.microsoft.com) shows is
quite similar to the one I have got to my mail address.
Any further opening-running from this Form, set virus to
my computer (even if you press No in MsgBox that
appeared). You can see this form on:
http://www.kabi.si/si21/fsav/swen.html (Page 4 and 5)
(Slovenian representative for f-prot).
The Form is very persuasive.

With kind regards Luka
 
Back
Top