Results 1 to 4 of 4
  1. #1
    joe55555 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2013
    Posts
    24

    what are the XX andd YY !?

    i have a command button in access with the following event code:

    Code:
    Private Sub Search1_AfterUpdate()
    XX = [Search1]
    YY = "*" & [Search1] & "*"
    [Search1] = YY
    Forms![Frmsearch]![FrmSrch].Requery
    [Search1] = XX
    End Sub
    [Search1] is the name of the button

    just like that alone without any other code in the vba.


    how are the XX and YY used without any declaration ?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,640
    If the module header does not have the line Option Explicit then variables don't have to be declared. Should always add that line to module headers.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    joe55555 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2013
    Posts
    24
    it has only Option Compare Database and then the code i posted.
    isn't suppoed to show an error for not declaring XX and YY?
    what would the XX and YY role be if they're not declared !!

    i'm sorry maybe my questions naive, but i didn't understand it :S

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,640
    Type Option Explicit into the header just below Option Compare Database. Now the error message will show when you run Debug>Compile.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

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