A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Relationship



 
 
Thread Tools Display Modes
  #11  
Old April 16th, 2009, 01:15 AM posted to microsoft.public.access.tablesdbdesign
MS
external usenet poster
 
Posts: 76
Default combobox

here it is..
Private Sub Command41_Click()

Client = Me.ClientCombo.Value
dureeTOTAL = DLookup("TOTAL", "client_total", "Client='" & Client & "'")
Me.txtdureeTOTAL.Value = dureeTOTAL

'RECHERCHER LA DATE DE FABRICATION
dateDebutfab = DLookup("DB", "client_date", "Client='" & Client & "'")
dateFinfab = DLookup("DF", "client_date", "Client='" & Client & "'")
Me.txtdatefab.Value = dateDebutfab & " Ã* " & dateFinfab

'RECHERCHER L'HEURE TOTALE DE PRODUCTION SUIVANT LES CLIENTS
prodTOTAL = DLookup("TOTAL", "client_tache", "Client='" & Client & "' AND
numT=1")
'prodTOTAL1 = DLookup("TOTAL", "MOCN_total", "Client='" & Client & "'")
'prodTOTAL2 = DLookup("TOTAL", "client_total", "Client='" & Client & "'")
Me.txtprod.Value = prodTOTAL

'RECHERCHER L'HEURE TOTALE DE NON PRODUCTION SUIVANT LES CLIENTS
nonprodTOTAL = DLookup("TOTAL", "client_tache", "Client='" & Client & "' AND
numT=2")
Me.txtnonprod.Value = nonprodTOTAL



'CALCULER LE TRP DE PRODUCTION
Me.txtTRP.Value = (prodTOTAL / dureeTOTAL)

'CALCULER LE NON TRP
Me.txtNONTRP.Value = (nonprodTOTAL / dureeTOTAL)

'RECHERCHER LE TONNAGE POUR CHAQUE CLIENT ET CALCULER HEURE/TONNE
tonnage = DLookup("Tonnage", "client_tonnage", "Client='" & Client & "'")
Me.txt_tonnage.Value = (dureeTOTAL / tonnage)

'If (Me.txtNONTRP.Value = Null) Then Me.txtNONTRP.Value = 0

End Sub

i dont know is this helpful..
thank you in advance.

"John W. Vinson" wrote:

On Wed, 15 Apr 2009 15:21:01 -0700, MS wrote:

Thank you for your reply, but i dont think its because of bound or unbound
control. I have changed it to unbound but that doesn't change anything, the
name still replace with another one in the combo list.. Do you have any other
idea?
thank you..


Care to post your code? It's a bit hard to debug it without seeing it.

Indicating the Control Source, Rowsource, and Bound Column of the combo should
help too.
--

John W. Vinson [MVP]

  #12  
Old April 16th, 2009, 10:43 AM posted to microsoft.public.access.tablesdbdesign
MS
external usenet poster
 
Posts: 76
Default combobox


HI, does any one can help me?

I want to make appear the value 0 when its null. How can i write the code in
VBA? i tried this one but nothing happens. Your help will very much
appreciated.

If prod_TOTAL = Null Then
Me.txt_Prod.Value = "0"
End If

  #13  
Old April 16th, 2009, 06:09 PM posted to microsoft.public.access.tablesdbdesign
John W. Vinson
external usenet poster
 
Posts: 18,261
Default combobox

On Thu, 16 Apr 2009 02:43:01 -0700, MS wrote:


HI, does any one can help me?

I want to make appear the value 0 when its null. How can i write the code in
VBA? i tried this one but nothing happens. Your help will very much
appreciated.

If prod_TOTAL = Null Then
Me.txt_Prod.Value = "0"
End If


Null is a funny beast. It means "undefined, unknown, unspecified". As such
nothing is equal to NULL, or for that matter unequal to NULL - you don't know
what it is, so there's no way to decide!

The solution is to use either the NZ - Null To Zero - function, or the
IsNull() function:

Me.txt_Prod= NZ(prod_TOTAL, "0")

will return a text string zero to the txt_PROD control (if the field is
numeric rather than text, leave off the quote marks).

In other cases you can use the IsNull() VBA function:

If IsNull(prod_TOTAL) Then
do something
Else
do something else
End If

This will only work if prod_TOTAL is a Variant (a datatype which accepts
nulls).
--

John W. Vinson [MVP]
  #14  
Old April 22nd, 2009, 04:51 PM posted to microsoft.public.access.tablesdbdesign
MS
external usenet poster
 
Posts: 76
Default LOOP NOT INITIALIZED


HI,
can somebody please help me. Every time I want to create a subform in a form
a notice pop out, it says: For loop not initialized.

I don't know why is this happening so suddenly but i cannot make subforms
that i want.
The same thing happens when i click on analyze in the ribbon.
Your help will be much appreciated.
  #15  
Old April 22nd, 2009, 05:17 PM posted to microsoft.public.access.tablesdbdesign
Larry Daugherty
external usenet poster
 
Posts: 1,012
Default dOES yOUR sHIFT kEY wORK?

For X = SomeValue (Down/)To SomeOtherValue

HTH
--
-Larry-
--

"MS" wrote in message
...

HI,
can somebody please help me. Every time I want to create a subform

in a form
a notice pop out, it says: For loop not initialized.

I don't know why is this happening so suddenly but i cannot make

subforms
that i want.
The same thing happens when i click on analyze in the ribbon.
Your help will be much appreciated.



  #16  
Old April 22nd, 2009, 05:20 PM posted to microsoft.public.access.tablesdbdesign
MS
external usenet poster
 
Posts: 76
Default dOES yOUR sHIFT kEY wORK?


Im sorry, i dont understand what are you trying to say.. Could you specify
me more about it?
Thank you

"Larry Daugherty" wrote:

For X = SomeValue (Down/)To SomeOtherValue

HTH
--
-Larry-
--

"MS" wrote in message
...

HI,
can somebody please help me. Every time I want to create a subform

in a form
a notice pop out, it says: For loop not initialized.

I don't know why is this happening so suddenly but i cannot make

subforms
that i want.
The same thing happens when i click on analyze in the ribbon.
Your help will be much appreciated.




  #17  
Old April 23rd, 2009, 12:38 AM posted to microsoft.public.access.tablesdbdesign
Larry Daugherty
external usenet poster
 
Posts: 1,012
Default dOES yOUR sHIFT kEY wORK?

Look in Help for "For ... Next". Help is where I found soooo many
"secrets".

example:

dim x as integer

For x = 1 to 10
do something
next

HTH
--
-Larry-
--

"MS" wrote in message
...

Im sorry, i dont understand what are you trying to say.. Could you

specify
me more about it?
Thank you

"Larry Daugherty" wrote:

For X = SomeValue (Down/)To SomeOtherValue

HTH
--
-Larry-
--

"MS" wrote in message
...

HI,
can somebody please help me. Every time I want to create a

subform
in a form
a notice pop out, it says: For loop not initialized.

I don't know why is this happening so suddenly but i cannot make

subforms
that i want.
The same thing happens when i click on analyze in the ribbon.
Your help will be much appreciated.






 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:18 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.