Form

J

JAmie

Hi

I have a Sub how takes a Form as parameter, I have to
call this Sub from a form to applicate the code so it's
take a Form as input I pass the name of the form: Me.form

But it's not working

This is my code:

The Sub:
========

Public Sub MaxSpecification(Frm As Form)
Dim intSpecifications As Variant
dim iSpecificationChoice As Variant

intSpecifications = DCount
("[SpecificationID]", "Tb_Specification", "[ItemID] = " &
1

iSpecificationChoice = DCount
("[SpecificationID]", "Tb_SpecificationParLigneCommande",
"[LigneCommandeID] = " & 1

If intSpecifications = iSpecificationChoice Then
Frm .AllowAdditions = False
Else
Frm .AllowAdditions = True
End If
End Sub
========================================================

I call the Sub from this code:

First methode:
=============

MaxSpecification(Me.form)

===
Or
===
Second Methode:
==============

Dim FrmCurrent as From
set FrmCurrent = [Forms]![FrmClient]![FrmAdress]
MaxSpecification(FrmCurrent)

Did somebody have in idea why I have the message:
Incompibale type when the compiler Arrive to
MaxSpecification(Me.form) or MaxSpecification(FrmCurrent)

Thanks
 
G

Guest

Try passing Me.Name as the name of the for

----- JAmie wrote: ----

H

I have a Sub how takes a Form as parameter, I have to
call this Sub from a form to applicate the code so it's
take a Form as input I pass the name of the form: Me.for

But it's not workin

This is my code

The Sub
========

Public Sub MaxSpecification(Frm As Form
Dim intSpecifications As Varian
dim iSpecificationChoice As Varian

intSpecifications = DCoun
("[SpecificationID]", "Tb_Specification", "[ItemID] = " &


iSpecificationChoice = DCoun
("[SpecificationID]", "Tb_SpecificationParLigneCommande",
"[LigneCommandeID] = " &

If intSpecifications = iSpecificationChoice Then
Frm .AllowAdditions = Fals
Els
Frm .AllowAdditions = Tru
End I
End Su
=======================================================

I call the Sub from this code

First methode
============

MaxSpecification(Me.form

==
O
==
Second Methode
=============

Dim FrmCurrent as Fro
set FrmCurrent = [Forms]![FrmClient]![FrmAdress
MaxSpecification(FrmCurrent

Did somebody have in idea why I have the message
Incompibale type when the compiler Arrive to
MaxSpecification(Me.form) or MaxSpecification(FrmCurrent

Thank
 
J

Jamie

Hi Howard

I tryed this one but it's not working same error

Me.Name return a String and my Sub takes a Form
Thanks
-----Original Message-----
Try passing Me.Name as the name of the form

----- JAmie wrote: -----

Hi

I have a Sub how takes a Form as parameter, I have to
call this Sub from a form to applicate the code so it's
take a Form as input I pass the name of the form: Me.form

But it's not working

This is my code:

The Sub:
========

Public Sub MaxSpecification(Frm As Form)
Dim intSpecifications As Variant
dim iSpecificationChoice As Variant

intSpecifications = DCount
("[SpecificationID]", "Tb_Specification", "[ItemID] = " &
1

iSpecificationChoice = DCount
("[SpecificationID]", "Tb_SpecificationParLigneCommande",
"[LigneCommandeID] = " & 1

If intSpecifications = iSpecificationChoice Then
Frm .AllowAdditions = False
Else
Frm .AllowAdditions = True
End If
End Sub
========================================================

I call the Sub from this code:

First methode:
=============

MaxSpecification(Me.form)

===
Or
===
Second Methode:
==============

Dim FrmCurrent as From
set FrmCurrent = [Forms]![FrmClient]![FrmAdress]
MaxSpecification(FrmCurrent)

Did somebody have in idea why I have the message:
Incompibale type when the compiler Arrive to
MaxSpecification(Me.form) or MaxSpecification (FrmCurrent)

Thanks


.
 

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

Top