Joe Hecht
joe at anamericanjoe.us
Thu Mar 6 08:59:00 CST 2008
Thanks Max, It was the string NZ that worked Joe Hecht Joe at anamericanjoe.us -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Max Wanadoo Sent: Thursday, March 06, 2008 12:36 AM To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] Code Help Please Hi Joe, You currently are using the dot notation (me.txtQBInvoice). This relates to an object eg: a property object. To refer to a control value, use the pling (!) notation as per examples below. Your code seems to indicate that selection of a QB Invoice is done via a combo or list box. If this is the case, then your are probably using a numbered key. If so, then the test should be for zero and not for null. If it is a value which is keyed in then you need to decide if it is set up for a number or a string and act accordingly. In any case, I would change the code to something like this. if nz(me!txtQBInvoice,0) = 0 then. or if nz(me!txtQBInvoice,"")="" then depending on if you are expecting a number or string. Max -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Joe Hecht Sent: Thursday, March 06, 2008 3:26 AM To: 'Access Developers discussion and problem solving' Subject: [AccessD] Code Help Please The following code is supposed to make sure there is an invoice number in the text box before previewing report. When I run it I get an application error msg box saying object required. What have I forgotten now, On Error GoTo Err_cmdPreviewPackList_Click Dim cancel As Boolean Dim lngRetval As Long If Me.txtQBInvoice Is Null Then lngRetval = MsgBox( _ "Please Select a Quick Books Invoice Number" & vbCrLf & "Before Running Report.", _ vbOKOnly + vbExclamation + vbDefaultButton2, _ "No QB Invoice Number Listed") Select Case lngRetval Case vbOK cancel = True End Select End If TIA Joe Hecht Joe at anamericanjoe.us -- 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