Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parameter Value and Null fields? 1

Status
Not open for further replies.

Kurt6905

Technical User
Aug 21, 2006
14
0
0
US
Hello,

I have the following program. When I go to run it, a box pops up asking me for a parameter value for 1%formulation. The column has numbers in it, however. Why am I getting that message?

Also, while 1%Formulation always has a number present in its dbase column, 2%,3%,4%Formulation are sometimes Null even though the column is set for a default value of 0. If nulls will throw the program out of wack, how do I compensate for that in the program?

Thanks for any advice.

Function DoChemConversions()
Const table As String = "[tbl Structural 2005]"

DoCmd.RunSQL "update " & table & " set [Active1] = [Active] * [1%Formulation] * 0.01"

DoCmd.RunSQL "update " & table & " set [Active2] = [Active] * [2%Formulation] * 0.01"

DoCmd.RunSQL "update " & table & " set [Active3] = [Active] * [3%Formulation] * 0.01"

DoCmd.RunSQL "update " & table & " set [Active4] = [Active] * [4%Formulation] * 0.01"

End Function
 
Code:
Function DoChemConversions()
Const table As String = "[tbl Structural 2005]"

DoCmd.RunSQL "update " & table & " set [Active1] = " & _
             [Active] * [red]NZ([/red][1%Formulation][red])[/red] * 0.01"

DoCmd.RunSQL "update " & table & " set [Active2] = " & _
             [Active] * [red]NZ([/red][2%Formulation][red])[/red] * 0.01"

DoCmd.RunSQL "update " & table & " set [Active3] = " & _
             [Active] * [red]NZ([/red][3%Formulation][red])[/red] * 0.01"

DoCmd.RunSQL "update " & table & " set [Active4] = " & _
             [Active] * [red]NZ([/red][4%Formulation][red])[/red] * 0.01"

End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top