Results 1 to 8 of 8

Opening A form through macro to a specific record

  1. #1
    deepakg27 is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2017
    Posts
    156

    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 is offline Access Developer
    Windows 7 32bit Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    2,029
    Perhaps:
    ="[SaleID]= " & [SaleID]
    If this helped, please click the star at the bottom left of this posting and add to my reputation. Many thanks.
    Not everyone can access an accdb, you may reach a broader audience by attaching in mdb format.

    Bob Fitzpatrick

    I have never failed. I have found a thousand ways that do not work!

    Microsoft Community Contributor Award (2011)



  3. #3
    deepakg27 is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2017
    Posts
    156
    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 is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    1,458
    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
    156
    without quotes nothing happens. Same results opening form with all records accessible.

    Regards
    Deepak Gupta

  6. #6
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    18,978
    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
    www.BaldyWeb.com

  7. #7
    deepakg27 is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2017
    Posts
    156
    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 is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    1,458
    =[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, 04:53 AM
  2. Replies: 3
    Last Post: 01-30-2015, 12:52 PM
  3. Replies: 5
    Last Post: 01-23-2015, 11:59 PM
  4. Opening Form to a Specific Record
    By PPat in forum Forms
    Replies: 9
    Last Post: 04-24-2013, 07:47 PM
  5. Help with opening form to specific record
    By manic in forum Programming
    Replies: 7
    Last Post: 09-18-2012, 07: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
  •  
Tech Forums: Microsoft Office Forums