Results 1 to 2 of 2
  1. #1
    danniel is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    May 2016
    Posts
    1

    Question help with IF in Macro

    i wan nt to make a macro that will decide which form to open by if a numeric result of a querry is bigger than 0
    i tried to do this
    Attachment 24755
    and i got this error message
    Attachment 24756
    i also tried putting brackets on the sides and it didnt work either
    Attachment 24757
    and got this error
    Click image for larger version. 

Name:	error 2.png 
Views:	10 
Size:	2.3 KB 
ID:	24758
    which lead me to try this
    Click image for larger version. 

Name:	attempt 3.png 
Views:	10 
Size:	1.7 KB 
ID:	24759
    which didn't work either...
    any help will be appreciated thanks in advance

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    skip the macro, just use code

    Code:
    dim lCnt as long 
    
    lCnt = dCount("*","myquery")
    if lCnt = 0 then
       docmd.openform "frmZero"
    else
       docmd.openform "frmLotsOfRecs"
    endif

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

Similar Threads

  1. Replies: 5
    Last Post: 09-19-2016, 01:35 PM
  2. Replies: 1
    Last Post: 01-21-2015, 02:02 PM
  3. Replies: 1
    Last Post: 01-13-2015, 01:33 PM
  4. Replies: 2
    Last Post: 05-05-2012, 02:34 AM
  5. Replies: 0
    Last Post: 01-12-2011, 12:43 PM

Tags for this Thread

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