Results 1 to 3 of 3
  1. #1
    recon2011 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jul 2011

    Using a macro in a datasheet subform to open a form

    I have a subform called TimecardList that lists the time sheets assigned to a project. The forms are linked by a common case number. The subform is on a form called Projects. I want to doubleclick on the ID field in the subform to open that particular time sheet. I know I can do it on a form but in datasheet view I cannot accomplish this. I've tried embedding an embedded macro and stand alone macro saved to the OnActivate field but it return all of the time sheets, not just the selected one. I don't know of a way of creating a button on the datasheet form although this would not be my first choice. Any suggestions? thanks.

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    You can use the double click event in a textbox or other control to fire VBA code. You can not use control buttons or other similar controls on a form in data sheet view. If your Data Sheet view form is a subform, open the subform directly in edit view to add your dbl click event subroutine.

    I assume when you refer to "Project" and "Forms" you are referring to projects and forms that office staff or production staff are working on as part of the daily business routines.

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    The Great Land
    It is possible in datasheet view. Is the object in the subform container a form or a table/query? Can't have code behind table/query object. Use a form object.

    I use the subform double click event and I put a label at top of the subform to instruct users "Double click in left margin of a record to view data." Then code in the subform's (the actual form, not the subform container control) DblClick event opens another form:

    DoCmd.OpenForm "form name", , "ID=" & Me.ID

    However, double click event of a textbox should also work, it does for me.
    How to attach file: 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.

Similar Threads

  1. Replies: 3
    Last Post: 08-18-2013, 09:14 PM
  2. Replies: 1
    Last Post: 07-22-2013, 12:00 PM
  3. Replies: 6
    Last Post: 11-21-2012, 05:10 PM
  4. Replies: 4
    Last Post: 10-06-2012, 04:45 AM
  5. Replies: 8
    Last Post: 08-26-2012, 11:11 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 - Senior Forums