Error handler for runtime error 92 "invalid use of null" not working

Hi,

I'm using a slightly modified form of the code found on
http://support.microsoft.com/kb/210271 to create a letter based on a
template with the name and address of the record you're viewing added
into it.

All I've changed from the code on the above website is the names of
some of the bookmarks/controls and I've got rid of the code for
copying a photograph as I don't need it.

You can see that the code works by copying the text from your control
and pasting it over one of the bookmarks in your word document. If the
control is empty then you would get a runtime error 92 "invalid use of
null" as you are trying to make a character string from a null - but
those thoughtful people at microsoft have put in an error handler at
the bottom for just this error, so that if this happens the empty
control will be replaced with a zero-length string and the code will
move on to the next bookmark.

But my problem is - runtime error 92 occurs anyway when an empty
control is used, as if the error handler doesn't exist!

Does anyone have any ideas?

Thanks in advance

0
omar
8/30/2007 9:28:46 AM
access.formscoding 7493 articles. 0 followers. Follow

3 Replies
917 Views

Similar Articles

[PageSpeed] 34

Forgot to say - i'm running office 2003 SP2 on WinXP SP2

0
omar
8/30/2007 9:31:19 AM
Its OK - i've figured it out. For some reason above my head you can't
set a control value in the On Open event - use the On Load event and
it works fine though.

0
omar
8/30/2007 1:48:26 PM
Hello everyone,

sorry to keep bumping this topic, but I accidentally put that last
post in the wrong forum - I was also trying to solve another problem
at the same time and figured it out, but this one still remains. If
anyone has any ideas I would much appreciate it.

Thanks

0
omar
8/31/2007 12:03:50 PM
Reply:

Similar Artilces:

Runtime error 94 invalid use of null #2
this is when creating a matrix item on the till. we go into quantity view and the error appears Microsoft RMS Windows Vista Thanks ...

"Invalid use of Null" in Query Design
Hello, This is the first time I get this error when running/editing a query. The strange thing is that the query runs, but after I have saved it, I cannot edit it in Query Design view (I get this error), I can only edit it in SQL View. The SQL (simplified) is: SELECT Claim.ClaimID, Source.Description, Claim.SourceID, Source.SourceID FROM Source RIGHT JOIN Claim ON Source.SourceID = Claim.SourceID ORDER BY Claim.SourceID; NOTE: Claim.SourceID is not required; Source.SourceID is key autonumber. The only thing I can think of is that Claim.SourceID may be null. But why does the query run and ...

"Invalid use of Null" in query
I have a query which has suddenly started giving this error. It is based on two other queries, each of which run OK. The query contains 4 left joins (I'm wanting to return a complete set of records from the left query), and the left query has no nulls in any field. The SQL of the query is: SELECT qryStaffEffortFYWBSDivPeriod.FY, qryStaffEffortFYWBSDivPeriod.WBS, qryStaffEffortFYWBSDivPeriod.DivID, qryStaffEffortFYWBSDivPeriod.Period, Sum(qryStaffEffortOverhead.Hours) AS TotalHours, Sum(qryStaffEffortOverhead.CostOH) AS TotalCostOH FROM qryStaffEffortFYWBSDivPeriod LEFT JOIN qr...

Query will not open in Design Mode
Access 2007, I've created the following query from two tables: SELECT tblTrnsctn.TxnDate, tblTrnsctn.Amount, tblCoa.AcntNmbr, tblCoa.AcntDscriptn, tblCoa.LeadSheet, tblCoa.qbListID FROM tblTrnsctn LEFT JOIN tblCoa ON tblTrnsctn.AccountRefListID = tblCoa.qbListID; This query seems to run fine, but once I save the query, I no longer can open the query in Design Mode to edit - I can view in sql mode. I modified the above query to return records that do not contain any null values in any fields. When I try to view the query in Design Mode - 'Invalid use of Null' error message is ret...

Error 94 Invalid use of Null
Hi Guys & Gals with knowledge to help, Below is a portion of code from my emailing form which I'm trying to build some error prevention bits into. At the .Subject= & or the .Body= statements I get an error "Run Time Error 94" "Invalid use of Null" & I can't figure out why it's not being trapped at the If Me![Subject] = "" Then statement. I had it as If Me![Subject] = Null Then with the same problem. If the fields are not blank then it runs through fine but if I leave either blank then error..... Set appOutlookRecip = .Re...

Run-Time Error '94' Invalid use of Null
Hi all, I use the below code to print Dymo labels, the purpose is to print the number of labels in the textbox TotalParcels.The code works fine on exsting records. When I attempt to print a new record I get Run-Time Error '94' Invalid use of Null The code highlights on this line >> For L = 1 To Forms!frmScan!ScanSub.Form.Parcels When I hover the mouse over the L it = 0 Thank you Richard ------------------------------------------------------------------------------------------------ Private Sub Label5_Click() Dim strWhere As String Dim L As Long If Me....

Union Query
A union query I developed has suddenly stopped working. The syntax is: SELECT * FROM [myQuery - Part 1] UNION SELECT * FROM [myQuery - Part 2]; Pulling up each query individually works fine. When i run the above union query I receive "Invalid use of Null". The number and order of the columns in each query are identical. Access 2003 here. Any ideas what could be the problem? I suspect it is the VBA code that you are using around the query, not the query, that stopped working. To confirm, does your query is executable from the query editor? If it does not, you also confirm t...

Error 94 Invalid use of Null
Hello! I had a previous post on this but have narrowed my troubles to this line. Why am I getting the Error 94 Invalid use of Null on the line of code for the curPymtsByLine? the locals window shows all the correct values for each variable. Dim lngInvID As Long Dim lngLineNum As Long Dim curPymtsByLine As Currency lngInvID = Nz(Me.PymtInvID) lngLineNum = Nz(Me.InvLineNum) ***curPymtsByLine = DSum("[Pymt]", "PaymentDetail", "[PymtInvID]= " & lngInvID & [InvLineNum] = lngLineNum) As always, thanks for the help! =?Utf-8?B?TWFya...

Invalid use of null on report
I am getting an 'Invalid use of Null' when launching a report on my database. I have reading about the use of "NZ" while looking up similar issues in this group, I am just not sure as to how to make use of it and where. I have been inspecting the report (as best as I could with my limited access kowledge) and I see there is a text box with the following control source: =IIf([InitialRecurrent]=1,"I","R") I found the source in one of the tables and noticed some of them where empty so I added values to the 'initialrecurrent' field in the table bu...

DOc 1 ERROR Invalid use of Null
When i was trying to upload some journal entries through IM, I encountered the above error. What does it means? I used the following fields for upload: JE#, tran_type, batchid, trx_date, reversing date, ref, acnum,amount I've added tran_type and reversing date and tested fine but all of a sudden I got that error. Is it to do with some column formatting? We are using GP9.0 Thanks Make sure you have no blank lines at the end of the file. Best regards, -- MG.- Mariano Gomez, MIS, MCP, PMP Maximum Global Business, LLC http://www.maximumglobalbusiness.com The Dynamics GP Blogster at http:...

Invalid use of Null error question
Can someone tell me why I'm getting an Invalid use of Null error message with this code please. Thanks Tony Forms!frmMain!SubForm1.Form.RecordSource = "SELECT * FROM [tblmaintabs] WHERE [txtmonthlabel] = #" & Format(strtxtdate, "mmmm/yyyy") & "# AND ([txtcompany] = '" & strtxtcompany & "' OR '" & strtxtcompany & "' IS Null);" You appear to have included extra single quotes around strtxtcompany in the IS Null comparison. However, there's really no point in including the IS Null in th...

Invalid use of Null explained
Could one of you clever pros kindly try to point me in the right direction; When creating a query, I get the error message "Invalid use of Null". I have used the Nz function in all the calculations, to no avail. If I could know why this error is generated, I might be able to find the bugger causing it. Thanks. Claude Make a copy of the query and drop fields from your query one by one to pinpoint the problem. If this doesn't work, then it is in your relationships. You might be trying to join on a datapoint that is Null. You can fix this by going into SQL mode and using Nz([...

Run-Time error '94': Invalid Use of Null??????
Hi I have a record lock function in my form which works fine until I click New Entry, which would normally start a new blank record. I keep getting the error message... Run-Time error '94': Invalid use of Null If I click Debug it highlights the line... If recordlock Then in yellow. This is the bit that is in the Form_Current area. Does anyone know what I need to do to get rid of it? The code looks like this but with 99% of all of the fields inserted into it inc its autonumber. Private Sub Form_Current() operativebutton.Enabled = Not IsNull(operativecombo) ...

Runtime error 94 invalid use of null
when creating a matrix item on the till. we go into quantity view and the error appears. Microsoft RMS Windows Vista Thanks, ...

Invalid use of Null 12-21-07
In my project I have a On Click action that opens another form. The code is: Private Sub JobName_Click() On Error GoTo HandleError Dim stDocName As String Dim stLinkCriteria As String stDocName = "frmProposal" stLinkCriteria = "[Proposal ID]=" & Me![Proposal ID] DoCmd.Close 'Close this form DoCmd.OpenForm stDocName, , , stLinkCriteria ExitHere: Exit Sub HandleError: MsgBox Err.Description Resume ExitHere End Sub Pretty straight forward and it works great. I think something is corupting the application though, because o...

Error "invalid use of null" when using the Upsizing Wizard
I am supporting a client who is attempting to use the Upsizing wizard. He gets the following error message: "Invalid use of Null" The "Invalid Use of Null" error occurs before the conversion begins. To check the base line data, I created a new Access database with one simple table. I still get the "Invalid Use of Null" before the conversion begins. My client is on a Windows XP machine with Access 2002. Any help would be greatly apprciated. Thanks "larry" <anonymous@discussions.microsoft.com> schreef in bericht news:28c1301c46425$7cfc3ed0...

Error 94 Invalid Use of Null
This code was working at first with the help of the experts on this site but I went on a 2 week Military Training and came back to finish up this database and now it's giving me an error of "Error 94 Invalid Use of Null". What in creation could have happened? This is my code. Could it be the formatting on the form? I think I changed the formatting of cells and am not using some of the fields. Please HELP!! Private Sub AddAppt_Click() On Error GoTo AddAppt_Err ' Save record first to be sure required fields are filled. DoCmd.RunCommand acCm...

Invalid Use of Null
Hello, trying to upsize my Access db to SQL Server 2000. I keep getting the message "Invalid Use of Null". -This message comes up immdediately after clicking next after entering my password. It doesn't even take a few seconds as if it's connecting to something, it just comes up immediately. -I tried creating a new database with one simple table in it and got the same error -I tried linking a table to the SQL server with an ODBC connection and it seems to work fine. This all suggests to me that it isn't a problem with the database, but either a problem with Acces...

Invalid use of Null
Hi, M getting error (Invalid use of Null) with crosstab where i have used left outer join. I tried different ways to get rid of error message but it follows all the time. I tried using "Nz" "IIF" but didnt work. Please help if someone can help me on my below query. TRANSFORM Sum(IIf([ANR]>0,[ANR],0)) AS Expr1 SELECT report4.country FROM report4 LEFT JOIN REPORT4_ACTUALS ON (report4.PL = REPORT4_ACTUALS.PL) GROUP BY report4.country PIVOT REPORT4_ACTUALS.Expr2 Thanks in advance, Vikram Hi, Try first creating a normal select query that returns the records which you...

Invalid use of Null error
I have a control on a form that calculates a persons age from the date of birth. However if the date of birth control is blank and the user tabs into the age control they get a Invalid use of Null error. How can I stop the error message? Here is my code for age Private Sub txtAge_Enter() Dim dateBirthday As Date dateBirthday = Date_of_Birth.Value Dim varAge As Variant varAge = -DateDiff("yyyy", Date, dateBirthday) Dim varDiff As Variant varDiff = DateDiff("d", DateAdd("yyyy", varAge, dateBirthday), Date) If varDiff < 0 Then varAge = varAge ...

every query throws "invalid use of null"
Hi all, I have a "large" (1GB) multi-user database that all of the sudden starting throwing the "invalid use of null error" for EVERY query in the database when opened straight into design view. This db has been working fine for months until today. So far, I've compacted and repaired, confirmed that all fields passed into functions are not null, and checked that all VBA references are intact. Nothing worked. When creating a new query and executing from design view all single source queries run fine (if you save then go back into design view you get the error). How...

"Invalid use of null" when opening a form in Access 2007
I have a form that displays a list of orders. The form has worked fine until recently when it gave out the "Invalid use of null" error on opening. The form triggers no events when it opens. I have created a blank database and imported the tables, forms etc from the original to the blank hoping that the problem may have been a glitch but that never fixed it. Can anyone help? Do you have any fields with DLookup() or another domain aggregate function in the record source? If there are no events initiated by the form, it is probably a field looking up a value or the form's...

Error handler for runtime error 92 "invalid use of null" not working
Hi, I'm using a slightly modified form of the code found on http://support.microsoft.com/kb/210271 to create a letter based on a template with the name and address of the record you're viewing added into it. All I've changed from the code on the above website is the names of some of the bookmarks/controls and I've got rid of the code for copying a photograph as I don't need it. You can see that the code works by copying the text from your control and pasting it over one of the bookmarks in your word document. If the control is empty then you would get a runtime error 92 ...

Invalid use of Null --> Help Please
Hi all: I am getting an invalid use of null in the if statement below (in Access 2000) and do not usnderstand why. Can anyone help me? Background: - rs has been declared as a recordset - rs!GrowerEmail is the email address for our grower/customer - the code below is part of the code used to email a report to our growers/customers and works find for those records where the email address is not blank/null. - when I put in a control stop and run the program in debug mode and step through each line of code and hover my mouse of "rs!GrowerEmail" in the "If ...

Invalid use of Null ----> Help Please
Hi all: I am getting an invalid use of null in the if statement below and do not usnderstand why. Can anyone help me? Background: - rs has been declared as a recordset - rs!GrowerEmail is the email address for our grower/customer - the code below is part of the code used to email a report to our growers/customers and works find for those records where the email address is not blank/null. - when I put in a control stop and run the program in debug mode and step through each line of code and hover my mouse of "rs!GrowerEmail" in the "If rs!GrowerEmail ...