Results 1 to 6 of 6
  1. #1
    Nathan23 is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2016
    Posts
    3

    Lightbulb Command button (event procedure)

    I have added a command botton (20) to add new record with the event procedure as follow below:

    Private Sub Command20_Click()


    DoCmd.OpenForm "sbfAwards_Tracker", , , , acFormAdd, , Me.EIN
    Forms!sbfAwards_Tracker.EIN = Me.EIN
    End Sub

    But its saying compile error:

    Method or data member not found.

    Any help is appreciated thanks

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    Is there a control named EIN in each of the two forms? If not, which form has the control named EIN?

  3. #3
    Nathan23 is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2016
    Posts
    3
    yes both from the Personnel data tbl and Award tracker tbl have Employee Identification Number (EIN). and both Award form and subform have EIN.

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    Quote Originally Posted by Nathan23 View Post
    yes both from the Personnel data tbl and Award tracker tbl have Employee Identification Number (EIN). and both Award form and subform have EIN.
    That is not really answering the question I was after.

    The following line is opening a form named sbfAwards_Tracker
    DoCmd.OpenForm "sbfAwards_Tracker", , , , acFormAdd, , Me.EIN

    When the application halts because of the error, click on the "Debug Option". Is it the above line of code that causes the error (highlighted when you click debug)?

  5. #5
    Micron is online now Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,424
    Forms!sbfAwards_Tracker.EIN = Me.EIN
    If that is a subform referenced (as suggested by sbf) then it is incorrect and could be the member that the message refers to. The syntax for referencing a subform control is
    [Forms]![Main form name]![subform control name].[Form]![control name on subform]
    Subform control name is the name of the subform control, not the subform.
    Last edited by Micron; 08-14-2016 at 08:43 PM. Reason: clarification
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  6. #6
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    @Micron
    Yeah, that may be part of the issue. However, the form being opened has the same name. I guess the mystery continues.

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

Similar Threads

  1. External script to call Command Button Click event handler
    By Sean Nakasone in forum Programming
    Replies: 5
    Last Post: 10-29-2014, 12:35 PM
  2. Replies: 1
    Last Post: 03-29-2014, 07:46 PM
  3. Replies: 3
    Last Post: 05-07-2012, 12:17 PM
  4. Command button click event
    By R_jang in forum Programming
    Replies: 10
    Last Post: 10-29-2010, 10:13 PM
  5. Replies: 1
    Last Post: 07-27-2010, 02:27 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