Marcus, Scott (GEAE, Contractor)
scott.marcus at ae.ge.com
Mon Jul 21 06:47:22 CDT 2003
Pedro, It sounds like you don't have one of the controls named properly. Check all your controls and make sure they are named properly. Scott -----Original Message----- From: Pedro Janssen [mailto:pedro at plex.nl] Sent: Saturday, July 19, 2003 3:36 PM To: Access Developers discussion and problem solving Subject: Re: Re: [AccessD] shorter and quicker code Hi Scott, because i had 10 chbProductCode's i placed ElseIf chbProductCode3 = true then strNumber = "3" bolFound = True etc. etc in the code. chbProductCode 1 and 2 are working fine. >From 3 i get an error. Error No: 5; Description: Invalid procedure-calling or invalid argument (I'll hope i have got the translation right, because we are using Dutch versions) I can't figure out why this error exists. Pedro ----- Original Message ----- From: tsm at zoomtown.com <mailto:tsm at zoomtown.com> To: Access Developers discussion and <mailto:accessd at databaseadvisors.com> problem solving Sent: Saturday, July 19, 2003 12:49 AM Subject: Re: Re: [AccessD] shorter and quicker code Pedro, I was working off the top of my head and forgot some stupid stuff so I fixed it. Also, this may be faster to write but it will run slower. Dim strNumber as String Dim bolFound as Boolean bolFound = False If chbProductCode1 = true then strNumber = "1" bolFound = True ElseIf chbProductCode2 = true then strNumber = "2" bolFound = True EndIf If bolFound = True then .Item("ProductCode" & strNumber).Value = Nz(Me("txtProductCode" & _ strNumber)) .Item("Number" & strNumber).Value = Nz(Me![txtNumber]) If chbA1 = True then .Item("Price" & strNumber).Value = Nz(Me("txt" & _ strNumber & "c16")) ElseIf chbA2 = True then .Item("Price" & strNumber).Value = Nz(Me("txt" & _ strNumber & "c17")) ElseIf chbA3 = True then .Item("Price" & strNumber).Value = Nz(Me("txt" & _ strNumber & "c18")) ElseIf chbUitz1 = True then .Item("Number" & strNumber).Value = Nz(Me("txtUitz" & _ strNumber & "Number")) .Item("Price" & strNumber).Value = Nz(Me("txtUitz" & _ strNumber & "Price")) End If End If Scott From: <tsm at zoomtown.com> Date: 2003/07/18 Fri PM 06:38:12 EDT To: Access Developers discussion and problem solving <accessd at databaseadvisors.com> Subject: Re: [AccessD] shorter and quicker code Pedro, Try the following: Dim strNumber as String Dim bolFound as Boolean bolFound = False If chbProductCode1 = true then strNumber = 1 bolFound = True ElseIf chbProductCode2 = true then strNumber = 2 bolFound = True EndIf If bolFound = True then .Item("ProductCode" & strNumber).Value = Nz(Me![txtProductCode1]) .Item("Number" & strNumber).Value = Nz(Me![txtNumber]) If chbA1 = True then .Item("Price" & strNumber).Value = Nz(Me("txt" & _ strNumber & "c16")) ElseIf chbA2 = True then .Item("Price" & strNumber).Value = Nz(Me("txt" & _ strNumber & "c17")) ElseIf chbA3 = True then .Item("Price" & strNumber).Value = Nz(Me("txt" & _ strNumber & "c18")) ElseIf chbUitz1 = True then .Item("Number" & strNumber).Value = Nz(Me("txtUitz" & _ strNumber & "Number")) .Item("Price" & strNumber).Value = Nz(Me("txtUitz" & _ strNumber & "Price")) End If End If Scott From: "Pedro Janssen" <pedro at plex.nl> Date: 2003/07/18 Fri PM 05:31:35 EDT To: <AccessD at databaseadvisors.com> Subject: [AccessD] shorter and quicker code Hello Group, the code below is part of a code that i have to write in about five versions for 10 ProductCode's. This is a lot of typing, copying, pasting and you can't let your mind slip away, otherwise you make mistakes. Is there a shorter and quicker way? TIA Pedro Janssen If chbProductCode1= True then .Item("ProductCode1").Value = Nz(Me![txtProductCode1]) If chbA1 = True then .Item("Number1").Value = Nz(Me![txtNumber]) .Item("Price1").Value = Nz(Me![txt1c16]) ElseIf chbA2 = True then .Item("Number1").Value = Nz(Me![txtNumber]) .Item("Price1").Value = Nz(Me![txt1c17]) ElseIf chbA3 = True then .Item("Number1").Value = Nz(Me![txtNumber]) .Item("Price1").Value = Nz(Me![txt1c18]) ElseIf chbUitz1 = True then .Item("Number1").Value = Nz(Me![txtUitz1Number]) .Item("Price1").Value = Nz(Me![txtUitz1Price]) End If End If If chbProductCode2= True then .Item("ProductCode2").Value = Nz(Me![txtProductCode2]) If chbA1 = True then .Item("Number2").Value = Nz(Me![txtNumber]) .Item("Price2").Value = Nz(Me![txt2c16]) ElseIf chbA2 = True then .Item("Number2").Value = Nz(Me![txtNumber]) .Item("Price2").Value = Nz(Me![txt2c17]) ElseIf chbA3 = True then .Item("Number2").Value = Nz(Me![txtNumber]) .Item("Price2").Value = Nz(Me![txt2c18]) ElseIf chbUitz2 = True then .Item("Number2").Value = Nz(Me![txtUitz2Number]) .Item("Price2").Value = Nz(Me![txtUitz2Price]) End If End If _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com _____ Hello Group, the code below is part of a code that i have to write in about five versions for 10 ProductCode's. This is a lot of typing, copying, pasting and you can't let your mind slip away, otherwise you make mistakes. Is there a shorter and quicker way? TIA Pedro Janssen If chbProductCode1= True then .Item("ProductCode1").Value = Nz(Me![txtProductCode1]) If chbA1 = True then .Item("Number1").Value = Nz(Me![txtNumber]) .Item("Price1").Value = Nz(Me![txt1c16]) ElseIf chbA2 = True then .Item("Number1").Value = Nz(Me![txtNumber]) .Item("Price1").Value = Nz(Me![txt1c17]) ElseIf chbA3 = True then .Item("Number1").Value = Nz(Me![txtNumber]) .Item("Price1").Value = Nz(Me![txt1c18]) ElseIf chbUitz1 = True then .Item("Number1").Value = Nz(Me![txtUitz1Number]) .Item("Price1").Value = Nz(Me![txtUitz1Price]) End If End If If chbProductCode2= True then .Item("ProductCode2").Value = Nz(Me![txtProductCode2]) If chbA1 = True then .Item("Number2").Value = Nz(Me![txtNumber]) .Item("Price2").Value = Nz(Me![txt2c16]) ElseIf chbA2 = True then .Item("Number2").Value = Nz(Me![txtNumber]) .Item("Price2").Value = Nz(Me![txt2c17]) ElseIf chbA3 = True then .Item("Number2").Value = Nz(Me![txtNumber]) .Item("Price2").Value = Nz(Me![txt2c18]) ElseIf chbUitz2 = True then .Item("Number2").Value = Nz(Me![txtUitz2Number]) .Item("Price2").Value = Nz(Me![txtUitz2Price]) End If End If _____ _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com _____ _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://databaseadvisors.com/pipermail/accessd/attachments/20030721/731d885c/attachment-0001.html>