Page 1 of 2 12 LastLast
Results 1 to 15 of 21
  1. #1
    Sheba is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    239

    compiler error

    Hi, I have this code for an options Group control I just created on my form but when I compile it, it tells me "Method or data member not found"
    and it highlights the table field name.

    The field exists in the table! Could someone please tell me what is wrong here? Many thanks in advance

    If Me.NewRecord Then
    Me.Frame1058 = Null
    Else


    Me.Frame1058 = Switch(Me.notcort = "Normotensive (MAP >= 65mmHg)", 1, Me.notcort = "Allergy", 2)

    Click image for larger version. 

Name:	cmpileError.jpg 
Views:	16 
Size:	44.6 KB 
ID:	18210

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,933
    Is this code behind a form? Is the field in the form's RecordSource?
    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
    Sheba is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    239
    Hi June7, sorry the code is in the On_Current event of the form and the field is unbound...

  4. #4
    Sheba is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    239
    yes (if I understood you correctly) the field is in the table, which is the form's RecordSource

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,933
    Field is not unbound, a control can be unbound. If notcort is a field in RecordSource but not used as ControlSource, try using bang (!) instead of dot.

    Me!notcort

    Otherwise, bind a textbox to the field. Apparently, VBA is expecting to find a control because of the dot.
    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.

  6. #6
    Sheba is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    239
    I meant to say that the Control was unbound. I have over 30 option group controls in this form and each one has a similar line of code. However not all of them are flagged by this compiler error.

    I could try that but if I'm supposed to have used me!* instead of me.* wouldn't it have complained about all the other field names in the code? Just brain storming here...

  7. #7
    Sheba is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    239
    I changed it to me!notcort but still get the compiler error

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,933
    True, I was grabbing straws. Don't know your form structure. Did you try binding a textbox to the field just to see if that helps? Are you sure about spelling?

    The only other thought I have is corruption.
    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.

  9. #9
    Sheba is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    239
    the spelling is correct. it might be corruption and that is scary. I copied a form (in the same project) and spent two days modifying it. It will be terrible if I have to scrap it altogether

  10. #10
    Sheba is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    239
    I bound a text box to the field and it worked. I'll create new option group controls to replace the affected ones...
    hopefully that'll fix em. Thanks June7.
    I'll repost an update.

  11. #11
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,933
    Sometimes copying a form and deleting the old one will fix corruption but usually requires a new form object then try copy/paste all the controls from old. Sometimes just deleting and recreating problem controls will fix.
    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.

  12. #12
    Sheba is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    239
    Thanks June7 for your update. Sorry for my late response, I was away. I duplicated an old form and zapped all the controls on it. I then recreated each one (mind you, more than 30 of them) and added its code but I'm still getting the "Method or Data member not found" error for some of them. Please help

  13. #13
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,933
    If you want to provide db for analysis, follow instructions at bottom of my post.
    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.

  14. #14
    Sheba is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    239
    I want to copy the switchboard form and paste it in the version I'll upload but it is asking me to provide a password. I know the password but it is not giving me a textbox to input it How do I supply this password?

  15. #15
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,933
    Why is there a password? Where is code demanding password? Maybe not an issue if I can open db with shift key bypass. What form is the issue?
    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.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 01-23-2014, 07:49 AM
  2. Access 2007 Runtime Compiler
    By burrina in forum Security
    Replies: 9
    Last Post: 01-23-2013, 06:20 PM
  3. Compiler error: Method or member not found
    By JosmithTwo in forum Programming
    Replies: 3
    Last Post: 11-26-2012, 07:10 AM
  4. Replies: 0
    Last Post: 07-16-2012, 05:42 AM
  5. Compiler WRONG example-DB
    By pacala_ba in forum Access
    Replies: 12
    Last Post: 04-18-2009, 01:00 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