UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
> Invalid Use Of Null, Access 2016    
 
   
mike60smart
post Sep 16 2019, 11:40 AM
Post#1


UtterAccess VIP
Posts: 13,471
Joined: 6-June 05
From: Dunbar,Scotland


Hi Everyone

I have the following Code which is used to Duplicate a Record.

I am using a Main Form / Subform with Both the Main and Subform set as Single Form View.

On a Command Button on the Subform I have the following On Click Event which when I run it gives me the error "Invalid Use of Null" ?

Any help appreciated.

CODE
Private Sub cmdD_Click()
10    On Error GoTo cmdD_Click_Err

20    If Me.Dirty Then Me.Dirty = False
      Dim strSQL As String

      Dim lngResident_FK As Long
      Dim dteReviewDate As Date
      Dim strNursingCareNeedsNotes As String
      Dim strTherapyCareNeedsNotes As String
      Dim strDischargeLocation As String
      Dim strDischargePlan As String
      Dim strPriorSetting As String
      Dim strPrimaryComorbidities As String
      Dim lngNursingCaseMixCategory_FK As Long
      Dim strSkilledOT As String
      Dim strOTProjectedSched As String
      Dim strSkilledPT As String
      Dim strPTProjectedSched As String
      Dim strSkilledLPT As String
      Dim strSLPProjectedSched As String
      Dim strSkilledNsg As String
      Dim strAreasofFocusConcern As String
      Dim strCareConferences As String
      Dim strEstimatedTimeFrame As String
      Dim dte100thDayDateActual As Date
      Dim dteLastCoveredDay As Date

30    lngResident_FK = Me.Resident_FK
40    dteReviewDate = Date
50    strNursingCareNeedsNotes = Me.NursingCareNeedsNotes
60    strTherapyCareNeedsNotes = Me.TherapyCareNeedsNotes
70    strDischargeLocation = Me.DischargeLocation
80    strDischargePlan = Me.DischargePlan
90    strPriorSetting = Me.PriorSetting
100   strPrimaryComorbidities = Me.PrimaryComorbidities
110   lngNursingCaseMixCategory_FK = Me.NursingCaseMixCategory_FK
120   strSkilledOT = Me.SkilledOT
130   strOTProjectedSched = Me.OTProjectedSched
140   strSkilledPT = Me.SkilledPT
150   strPTProjectedSched = Me.PTProjectedSched
160   strSkilledLPT = Me.SkilledSLP
170   strSLPProjectedSched = Me.SLPProjectedSched
180   strSkilledNsg = Me.SkilledNsg
190   strAreasofFocusConcern = Me.AreasofFocusConcern
200   strCareConferences = Me.CareConferences
210   strEstimatedTimeFrame = Me.EstimatedTimeFrame
220   dte100thDayDateActual = Me![100thDayDateActual]
230   dteLastCoveredDay = Me.LastCoveredDay


240   strSQL = "INSERT INTO tblCareReviews (Resident_FK, ReviewDate, NursingCareNeedsNotes, DischargeLocation, DischargePlan, PriorSetting ," _
              & " PrimaryComorbidities, NursingCaseMixCategory_FK, SkilledOT, OTProjectedSched ," _
              & " SkilledPT, PTProjectedSchedule, SkilledLPT, SLPProjectedSchedule, SkilledNsg, AreasofFocusConcern, DischargePlan, CareConferences, EstimatedTimeFrame, 100thDayDateActual, LastCoveredDay ) " _
              & "VALUES (" & lngResident_FK & ", " & Format(dteReviewDate, "\#dd\-mmm\-yyyy\#") & ", '" & strNursingCareNeedsNotes & "', '" & strTherapyCareNeedsNotes _
              & "', '" & strDischargeLocation & "', '" & strDischargePlan & "', '" & strPriorSetting & "', '" & strPrimaryComorbidities _
              & "', " & lngNursingCaseMixCategory_FK & ", '" & strSkilledOT & "', '" & strOTProjectedSched & "', '" & strSkilledPT & "','" & strPTProjectedSched _
              & "', '" & strSkilledLPT & "', '" & strSLPProjectedSched & "', '" & strSkilledNsg & "', '" & strAreasofFocusConcern & "', '" & strCareConferences _
              & "', '" & strEstimatedTimeFrame & "', " & Format(dte100thDayDateActual, "\#dd\-mmm\-yyyy\#") & ", " & Format(dteLastCoveredDay, "\#dd\-mmm\-yyyy\#") & ");"
250       Debug.Print strSQL
260       CurrentDb.Execute strSQL, dbFailOnError

270   MsgBox "Remember to update the Review date as necessary!!", vbCritical

280   Forms![frmResidentCareReviews].[frmCareReviewsSubform].Form.Requery
290   DoCmd.GoToRecord , , acLast
300   Me.ReviewDate.SetFocus


cmdD_Click_Exit:
310       Exit Sub

cmdD_Click_Err:
320       MsgBox Error$
330       Resume cmdD_Click_Exit


End Sub

--------------------
Hope this helps?

Mike

Get happiness out of your work or you may never know what happiness is.

Go to the top of the page
 

Posts in this topic
- mike60smart   Invalid Use Of Null   Sep 16 2019, 11:40 AM
- - theDBguy   Hi Mike. I didn't read the entire code. Which ...   Sep 16 2019, 11:54 AM
- - mike60smart   Hi theDBGuy That is the strange thing it does not...   Sep 16 2019, 01:40 PM
- - tina t   hi Mike, have you tried setting a breakpoint and s...   Sep 16 2019, 02:10 PM
|- - mike60smart   Hi tina Did that and located a wrong spelling. N...   Sep 16 2019, 02:40 PM
|- - theDBguy   "wrong spelling?" Interesting that you g...   Sep 16 2019, 03:01 PM
|- - mike60smart   Hi theDBGuy Yes Very strange. I put the break po...   Sep 16 2019, 03:05 PM
- - Phil_cattivocarattere   QUOTE (mike60smart)That is the strange thing it do...   Sep 16 2019, 11:24 PM
- - mike60smart   Hi Phil Many thanks for pointing that out. I tho...   Sep 17 2019, 07:48 AM
- - cheekybuddha   Hi Mike, You can probably make all this a lot eas...   Sep 17 2019, 03:08 PM
- - mike60smart   Hi David These lines all highlight in Red ?? COD...   Sep 17 2019, 04:05 PM
- - cheekybuddha   Good morning, Mike. It appears that you have lost...   Sep 18 2019, 03:21 AM
- - mike60smart   Hi David When I paste the strSQL into my code it ...   Sep 18 2019, 04:33 AM
- - mike60smart   Hi David This is what the code is now:- CODEPriv...   Sep 18 2019, 04:35 AM
- - Phil_cattivocarattere   In this lineCODE& " FROM tblCareReviews cr...   Sep 18 2019, 04:56 AM
- - mike60smart   Hi Phil Thanks. Changed that and now get the foll...   Sep 18 2019, 05:46 AM
|- - cheekybuddha   Hi Mike, Can you post the SQL output in the immed...   Sep 18 2019, 10:11 AM
|- - cheekybuddha   That's a weird one, Mike. What is highlighted...   Sep 18 2019, 11:35 AM
|- - mike60smart   Hi David The error Pops up and it does not highli...   Sep 18 2019, 12:03 PM
- - mike60smart   Hi Phil Is it because these two fields are DateTi...   Sep 18 2019, 05:52 AM
- - Phil_cattivocarattere   QUOTE (mike60smart)Is it because these two fields ...   Sep 18 2019, 06:01 AM
- - mike60smart   Hi Phil This is the Immediate Window:- CODEINSER...   Sep 18 2019, 06:08 AM
- - mike60smart   Hi Phil I rearranged the fields so that they now ...   Sep 18 2019, 06:36 AM
- - Phil_cattivocarattere   CODEstrSQL "INSERT INTO tblCareReviews...you m...   Sep 18 2019, 07:20 AM
|- - mike60smart   Hi Phil Ok now it reverts to the same Error 3075 ...   Sep 18 2019, 08:13 AM
- - cheekybuddha   Look at the beginning of line 30: You have: CODE3...   Sep 18 2019, 12:41 PM
- - mike60smart   Hi David No the code is this:- CODEPrivate Sub c...   Sep 18 2019, 12:47 PM
- - cheekybuddha   Not in Post#20, it wasn't!   Sep 18 2019, 12:53 PM
- - cheekybuddha   With the code in Post#27 I can not duplicate a com...   Sep 18 2019, 12:55 PM
- - mike60smart   Hi David Did a Compact & Repair and still no ...   Sep 18 2019, 01:48 PM
- - cheekybuddha   What happens when you do Debug->Compile ?   Sep 18 2019, 02:05 PM
- - mike60smart   Hi David I commented out all code and then did a ...   Sep 18 2019, 02:16 PM
- - cheekybuddha   Even with the code commented out? Do you know how...   Sep 18 2019, 02:18 PM
- - mike60smart   Hi David Here with a stripped down example   Sep 18 2019, 02:31 PM
- - cheekybuddha   Hi Mike, It looks like you are using a newer vers...   Sep 18 2019, 04:36 PM
|- - Phil_cattivocarattere   QUOTE (cheekybuddha)@Phil, are you still checking ...   Sep 19 2019, 03:07 AM
||- - cheekybuddha   @Phil, Great! Just wondered if you were able...   Sep 19 2019, 03:29 AM
|- - mike60smart   Hi David No there are no special fields like MVF ...   Sep 19 2019, 04:47 AM
|- - Phil_cattivocarattere   QUOTE (cheekybuddha)Just wondered if you were able...   Sep 19 2019, 07:13 AM
|- - mike60smart   Hi Phil & David I have managed to solve my pr...   Sep 19 2019, 11:36 AM
|- - cheekybuddha   Well, certainly an alternative way of going about ...   Sep 19 2019, 01:19 PM
- - tina t   hi Mike, i downloaded your test db, and ran it in ...   Sep 19 2019, 02:28 PM
- - mike60smart   Hi Tina Many thanks for the update. I will test ...   Sep 19 2019, 02:31 PM
|- - Phil_cattivocarattere   Tina_t got the same than me. Your test must pass.   Sep 19 2019, 02:33 PM
- - mike60smart   Hi Tina Many thanks just works a treat. Thanks a...   Sep 19 2019, 02:37 PM
- - tina t   you're welcome, hon, it's nice to finally ...   Sep 19 2019, 03:10 PM
- - cheekybuddha   Double-Yay!   Sep 20 2019, 04:18 AM
- - PatHartman   Just so you know, your original problem was caused...   Sep 21 2019, 10:18 AM



Custom Search


RSSSearch   Top   Lo-Fi    18th November 2019 - 07:40 PM