Results 1 to 6 of 6
  1. #1
    ano is offline Competent Performer
    Windows 11 Office 365
    Join Date
    Nov 2023
    Posts
    204

    changing from d_t_got_focus to bdo_afterupdate give error 424

    i was tired to see info that is only for qry by lack of rownum


    so i decide to hide it, realizing no focus anymore i decide to go next item in after update
    and can not find why it give an error on the visible and not on the hidden
    and the error line works in direct window
    and d_d_gotfocus no problem in bdo_afterupdate
    Code:
    'old situation visible but useless info
    Private Sub d_d_GotFocus()
    If Forms!balans!bl!d_d = 0 Then
    Forms!balans!bl!d_d = DCount("d_d", "bl") + 1
    End If
    End Sub
    
    
    Private Sub d_t_GotFocus()
    ' old situation visible but useless info
    If FindValue(Format(Forms!balans!bl!dt, "mmdd"), "0131", "0228", "0331", "0430", "0531", "0630", "0731", "0831", "0930", "1031", "1130", "1231") Then
    If Forms!balans!bl!d_t = 0 Then 'was already changed to null and 1st condition
    Forms!balans!bl!d_t = DMax("d_t", "bl") + 1
    End If
    End If
    End Sub
    
    
    Private Sub bdo_AfterUpdate()
    'new situation but d_t datasheetcaption " " d_t has same color back/fore ground rule needed the space to align
    ' d_t is meanwhile changed from 0 to null to create unique index and run in old situation already
      '  If Forms!balans!bl!d_t Is Null Then '?Forms!balans!bl!d_t --> null ,line but give error 424 object required, so out comment waiting to find solution. .value was also wrong
        If FindValue(Format(Forms!balans!bl!dt, "mmdd"), "0131", "0228", "0331", "0430", "0531", "0630", "0731", "0831", "0930", "1031", "1130", "1231") Then
        Forms!balans!bl!d_t = DMax("d_t", "bl") + 1
     '   End If
        End If
        If Forms!balans!bl!d_d = 0 Then ' d_d is hidden
        Forms!balans!bl!d_d = DCount("d_d", "bl") + 1
        End If
    End Sub

  2. #2
    ano is offline Competent Performer
    Windows 11 Office 365
    Join Date
    Nov 2023
    Posts
    204
    is it really true?
    in gotfocus i had to change "= null" into "is null" (which make it running) and na i needed back to "= null" what is the logic?

  3. #3
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,144
    In Access/SQL nothing ever = null not even Null = Null

    That why you have specific functions to check for Null values - either IsNull() for a control or Is Null in a query.

    You can prove this in the immediate window:

    Code:
    ? Null = Null
    Null
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  4. #4
    ano is offline Competent Performer
    Windows 11 Office 365
    Join Date
    Nov 2023
    Posts
    204
    Quote Originally Posted by Minty View Post
    In Access/SQL nothing ever = null not even Null = Null

    That why you have specific functions to check for Null values - either IsNull() for a control or Is Null in a query.

    You can prove this in the immediate window:

    Code:
    ? Null = Null
    Null
    it is neither in a control nor in a query it is in an if search 'access vba if null' in bing i did not get isnull() so i used =null which was wrong so i changed into is null which was working correct. till i decide to hide and focus not would work. so i change d_t_gotfocus into bdo_afterupdate and copy the d_d under it
    so a working line with other procedure name stop working searching give no clue direct window give no error. changing "is" back to "=" was the solution but why

  5. #5
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,144
    Forms!balans!bl!d_t is a control? and I assume this code is on that form ?
    In which case the correct syntax to use would be either

    If IsNull(Forms!balans!bl!d_t ) then

    or

    If IsNull(me.d_t) then
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  6. #6
    ano is offline Competent Performer
    Windows 11 Office 365
    Join Date
    Nov 2023
    Posts
    204

    solved

    btw ? in direct window reacted correct on the control so the control was not wrong used as dutch suggested qualifier needed (ur previous)
    yeah u right just dont understand it work without it and i not find that function 1st time. so nxt time problem i put function tnx tc enjoy

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 08-12-2014, 07:13 PM
  2. Replies: 9
    Last Post: 05-30-2014, 11:08 AM
  3. Replies: 8
    Last Post: 10-29-2013, 04:42 PM
  4. Replies: 3
    Last Post: 07-17-2013, 08:28 PM
  5. (simple) Expressions give error message
    By P.Hofman in forum Forms
    Replies: 3
    Last Post: 01-21-2010, 01:57 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums