Results 1 to 6 of 6
  1. #1
    cp1981 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Location
    Northeast Missouri
    Posts
    33

    IsNull Not IsNull expression/value not working properly

    Greetings!



    I copied/pasted from one of the MS Access template DB's (Asset tracking) macro to Open two separate forms depending on whether there is an [ID] or not. A "New Account" form if not (Null) and "Account Details" for the opposite. Heres my issue: Where the macro is supposed to Open the New Account form, it opens up a blank Account Details form. I've tried my newbie novice knowledge on changing the OpenForm amongst others, but no joy. So, within this macro will be three forms: "frmAccountList" (Where the magic begins; With the user clicking on "Open" where the form "frmAccountDetails" opens or with the user clicking on "New" where the form "frmNewAccount" opens.
    Click image for larger version. 

Name:	Screenshot 2024-03-10 180653.png 
Views:	32 
Size:	21.7 KB 
ID:	51581Click image for larger version. 

Name:	Screenshot 2024-03-10 175759.png 
Views:	31 
Size:	25.0 KB 
ID:	51582

  2. #2
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 11 Office 365
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,654
    Be much easier in VBA

    Code:
    If Me.NewRecord Then
            ' open the form to a new record
        Else
            ' open the form to the specified accountID
        End If
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  3. #3
    davegri's Avatar
    davegri is online now Excess Access
    Windows 11 Access 2019
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,413
    I copied/pasted from one of the MS Access template DB's (Asset tracking) macro to Open two separate forms depending on whether there is an [ID] or not.
    If you want to stick with macros, have another look at the asset tracking template. There are 2 on-click events calling separate macros, but both opening the same form. You apparently want to use 2 different forms.

    One event is when "OPEN" (existing account) is clicked, opening Asset Details form with search criteria,

    and the other macro for when "NEW" is clicked (opening same form in ADD mode).

    You will need to modify just the latter macro to open your form that creates new accounts.
    Last edited by davegri; 03-11-2024 at 07:03 PM. Reason: added option

  4. #4
    cp1981 is offline Advanced Beginner
    Windows 7 64bit Office 365
    Join Date
    Jul 2014
    Location
    Northeast Missouri
    Posts
    33
    Thank you so much to both of you guys for the help! I ended up going the VBA route. But regardless, both make sense! Again, thank you to both of you

  5. #5
    madpiet is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Feb 2023
    Posts
    154
    ( Once you get your head around VBA and the Access object model, you can do some really crazy stuff with Access. Definitely worth the investment... Well, it was when I started many moon ago. Even if you just learn the basics)

  6. #6
    cp1981 is offline Advanced Beginner
    Windows 7 64bit Office 365
    Join Date
    Jul 2014
    Location
    Northeast Missouri
    Posts
    33
    Quote Originally Posted by madpiet View Post
    ( Once you get your head around VBA and the Access object model, you can do some really crazy stuff with Access. Definitely worth the investment... Well, it was when I started many moon ago. Even if you just learn the basics)
    When I was in the service, I did an instructor tour in San Antonio and within our schoolhouse we used Access for our student DB. Later on we got a guy that was FANTASTIC at Excel. He and I ended up revamping the DB into excel. I learned quite a bit from him. Ive even made a few "DB"s myself from Excel. But I cant lie, there were MANY times I wished I knew my way around Access like I do with Excel. I even realized then I needed to know Access better. I'm really trying this time and have even bought a book The platform is OBVIOUSLY way better to work with than having to type up a mile long formula just to look up records and slowing the CPU in the process. Anyways, thank you for taking the time to give your $.02! I think Im just going to let Excel do what its truly meant for instead of trying to re-invent the wheel.

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

Similar Threads

  1. 'IIf(IsNull(' in query not working.
    By Samson in forum Access
    Replies: 3
    Last Post: 06-19-2023, 07:25 AM
  2. Adding a 3rd condition in IIf(IsNull expression
    By Holli in forum Programming
    Replies: 2
    Last Post: 05-20-2015, 01:04 PM
  3. IsNull not working
    By vbjohn in forum Access
    Replies: 19
    Last Post: 02-29-2012, 02:21 PM
  4. IsNull not working...
    By Moekandu in forum Programming
    Replies: 3
    Last Post: 01-29-2011, 06:48 PM
  5. Query using IIf(IsNull) expression
    By jmartin in forum Queries
    Replies: 3
    Last Post: 12-18-2009, 04:19 PM

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