Results 1 to 8 of 8
  1. #1
    deepakg27 is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2017
    Posts
    160

    Opening A form through macro to a specific record

    Hi Guys,



    I am working on a billing database.

    I have created a list of bills between specific date through a query, for which arguments are being passed by user input on main form & in subform the list is being displayed. Now I want user to be able to click on desired bill number to open the bill to that specific record and (frmSale is the form which needs to be opened) edit as per requirements. SaleID field is Number type. Textbox control on both forms is SaleID.

    I have tried using following command :

    ="[SaleID]=[SaleID] "
    ="[SaleID]='" & [SaleID] & "'"

    In other example I am able to achieve following through report, but the field is text type in place of number.

    Awaiting your help and guidance.
    Regards
    Deepak Gupta

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 7 32bit Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,530
    Perhaps:
    ="[SaleID]= " & [SaleID]
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    deepakg27 is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2017
    Posts
    160
    Dear Bob,

    Thanks for your reply. But Sorry it is not working. Asks for SaleID and upon pressing OK opens the form to a new record. If any number is inputed in the dialog box form opens to the first record and all the records are accessible.

    Thanks and Regards
    Deepak Gupta

  4. #4
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,388
    Don't think you need any quotes:
    =[SalesID] = SaledID

  5. #5
    deepakg27 is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2017
    Posts
    160
    without quotes nothing happens. Same results opening form with all records accessible.

    Regards
    Deepak Gupta

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    I don't use macros, but if you want to switch to VBA the syntax looks like:

    http://www.baldyweb.com/wherecondition.htm

    I assume a macro also wants delimiters for a text field, but I'm not sure how they're applied.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    deepakg27 is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2017
    Posts
    160
    Yes, I have the VB code, was wondering why macro is not working when it is working fine with text field. I would love to understand why?

    Thanks and Regards
    Deepak Gupta

  8. #8
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,388
    =[SaleID] = SaleID
    works for me. Perhaps your form is corrupt, especially if the VB does work with same criteria.

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

Similar Threads

  1. Replies: 3
    Last Post: 10-03-2015, 05:53 AM
  2. Replies: 3
    Last Post: 01-30-2015, 01:52 PM
  3. Replies: 5
    Last Post: 01-24-2015, 12:59 AM
  4. Opening Form to a Specific Record
    By PPat in forum Forms
    Replies: 9
    Last Post: 04-24-2013, 08:47 PM
  5. Help with opening form to specific record
    By manic in forum Programming
    Replies: 7
    Last Post: 09-18-2012, 08:44 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