MamadouNdaw
Registered User.
- Local time
- Today, 19:17
- Joined
- Nov 14, 2007
- Messages
- 17
I'm a beginner so go easy on me.
Ok, what I would like to do is simple. I have a combo box in a subform with a number of product related fields. I would like the form to automaticall display the unit price upon selecting the product from the combo box. So, what am I overlooking here....
The error I'm getting is
ERROR 2766 "The object doesn't cotain the automation object 'XXXX'
Where XXXX is the Product ID selected by the combo box. The product ID's follow the format P100, P101, P102, etc... Maybe I should also include my sql statemet for the combo box.
SELECT qryInventaire.[ProduitID], qryInventaire.[CatégorieID], qryInventaire.[Produit], qryInventaire.[QtyDisponible] FROM qryInventaire WHERE qryInventaire.[CatégorieID]="Marchandise" ORDER BY qryInventaire.[Produit];
So, I assume the problem is coming from my tblListeProduit table, but it does contain the ProduitID as a Primary Key.
My Code
------------------------------------------
Module Code:
---------------
___________________________________________________________________________
Public Enum StatutVenteEnum
Nouveau_StatutVente = 0
Facturé_StatutVente = 1
Fermé_StatutVente = 2
End Enum
______________________________________________________________________________
Public Function DLookupNumber(Expr As String, Domain As String, Optional Criteria As String, Optional ValueIfNull = 0) As Variant
DLookupNumber = Nz(DLookup(Expr, Domain, Criteria), ValueIfNull)
End Function
______________________________________________________________________________
Function GetPrixUnitaireProduit(lProduitID) As Currency
GetPrixUnitaire = DLookupNumber("[PrixUnitaire]", "tblListeProduit", "[ProduitID] = " & lProduitID)
End Function
_______________________________________________________________________________
Form Code:
-----------
_______________________________________________________________________________
Private Sub ProduitIDBox_AfterUpdate()
If Not IsNull(Me![ProduitID]) Then
Me![Quantité] = 1
Me![PrixUnitaire] = GetPrixUnitaireProduit(Me![ProduitID])
Me![Remise] = 0
Me![StatutID] = Nouveau_StatutVente
End If
End Sub
_____________________________________________________________________________
Ok, what I would like to do is simple. I have a combo box in a subform with a number of product related fields. I would like the form to automaticall display the unit price upon selecting the product from the combo box. So, what am I overlooking here....
The error I'm getting is
ERROR 2766 "The object doesn't cotain the automation object 'XXXX'
Where XXXX is the Product ID selected by the combo box. The product ID's follow the format P100, P101, P102, etc... Maybe I should also include my sql statemet for the combo box.
SELECT qryInventaire.[ProduitID], qryInventaire.[CatégorieID], qryInventaire.[Produit], qryInventaire.[QtyDisponible] FROM qryInventaire WHERE qryInventaire.[CatégorieID]="Marchandise" ORDER BY qryInventaire.[Produit];
So, I assume the problem is coming from my tblListeProduit table, but it does contain the ProduitID as a Primary Key.
My Code
------------------------------------------
Module Code:
---------------
___________________________________________________________________________
Public Enum StatutVenteEnum
Nouveau_StatutVente = 0
Facturé_StatutVente = 1
Fermé_StatutVente = 2
End Enum
______________________________________________________________________________
Public Function DLookupNumber(Expr As String, Domain As String, Optional Criteria As String, Optional ValueIfNull = 0) As Variant
DLookupNumber = Nz(DLookup(Expr, Domain, Criteria), ValueIfNull)
End Function
______________________________________________________________________________
Function GetPrixUnitaireProduit(lProduitID) As Currency
GetPrixUnitaire = DLookupNumber("[PrixUnitaire]", "tblListeProduit", "[ProduitID] = " & lProduitID)
End Function
_______________________________________________________________________________
Form Code:
-----------
_______________________________________________________________________________
Private Sub ProduitIDBox_AfterUpdate()
If Not IsNull(Me![ProduitID]) Then
Me![Quantité] = 1
Me![PrixUnitaire] = GetPrixUnitaireProduit(Me![ProduitID])
Me![Remise] = 0
Me![StatutID] = Nouveau_StatutVente
End If
End Sub
_____________________________________________________________________________