Results 1 to 11 of 11
  1. #1
    drow's Avatar
    drow is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2012
    Posts
    53

    Proper Syntax for TempVars and CurrentRecord


    Hello All,

    I am struggling with a syntax issue and hoping someone can point me in the right direction. I have a form with a continuous subform. In the subform I have added a unbounded text box which I want to use like a button to load another form. In the first form the subform contains a list of drawings, with the intent of the button within the subform to add work associated with each drawing. Therefore, I would like to use the TempVars functionality (or something similar) so that when the command button is clicked, an "on click" event is run where the primary key of the row on the subform is stored, and the second form is opened filtered for only that primary key.

    This syntax is obviously wrong but I would like to have something like SetTempVar(tmpDrawingID,[CurrentRecord].[PrimaryKeyID]).

    Somewhat related, if anyone knows where a good article can be found on setting up button controls within a continuous form that would be very helpful as some of the formatting that I am trying to apply does not appear in the form in form view.

    Thanks

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Is this what you want?

    BaldyWeb wherecondition
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    drow's Avatar
    drow is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2012
    Posts
    53
    Hi Paul,

    Thanks for getting back to me. That is essentially the functionality that I am trying to accomplish. I probably mis-stated my problem slightly because the DrawingID will not yet be present in table which is the record source for the second form. I would like to the form to open and it "known" that it should assigning the work to this DrawingID. The issue I am encountering (partly because I use Macro builder because my VBA skills are poor) is how to define, with proper syntax, the value in a field in the current row in a continuous subform. I have the following syntax but I cant see how to define further:

    =[Forms]![frmQuotes]![subfrmQuoteDrawings].[Form].?????

    Essentially control name needs to be the drawingID in the subform, and the criteria needs to be current records.

    Are you aware of any good tutorials that outline creating control buttons from unbound text boxes is continuous forms? I have seen some pretty slick applications of this type and would be interested to see how it was done.

    Thanks again.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Not aware of a tutorial offhand. Where you have ????? would be the name of the textbox containing drawingID. In a continuous form, that would refer to the record with focus.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    drow's Avatar
    drow is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2012
    Posts
    53
    Hi Paul,

    Thanks for bearing with me. The issue I am encountering is that there is no control for drawingID within the syntax. Specifically, when using macro builder, as the statement is constructed access will list the variables for each section (ex. after I type [Forms]!, the available forms are listed). In this case, after I type the following statement, there is no option for drawingID.

    =[Forms]![frmQuotes]![subfrmQuoteDrawings].[Form].

    Only form properties are available (setting column afterupdate, allowformview, etc.). I have attached a screenshot of the subform as well as what I am trying to accomplish, just to be sure that I am not explaining poorly or misunderstanding you.

    Thanks.
    Attached Thumbnails Attached Thumbnails subform.JPG  

  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,521
    Intellisense isn't always that...intelligent. You should be able to type in the name of the textbox. If not, can you post the db here?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    This works to refer to the drawing ID in the subform:

    [Forms]![frmQuotes].[subfrmQuoteDrawings].[Form]![DrawingID]
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  8. #8
    drow's Avatar
    drow is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2012
    Posts
    53
    Often it is the small things that burn me: ! vs .

    Thanks a bunch Paul.

  9. #9
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    No problem. That will often work either way. I just tested with . and it still worked fine.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  10. #10
    drow's Avatar
    drow is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2012
    Posts
    53
    Interesting, I should have tested it more thoroughly. I guess it threw me off that access didn't "known" it (i.e. it didn't auto populate the available options).

    Thanks again.

  11. #11
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    If you're bored, Google bang vs dot for all kinds of discussions, like:

    http://blogs.msdn.com/b/frice/archiv.../18/75685.aspx
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. TempVars.add and make value ID
    By Ruegen in forum Programming
    Replies: 4
    Last Post: 12-31-2013, 06:19 PM
  2. Replies: 0
    Last Post: 07-11-2013, 02:21 PM
  3. Using TempVars in query
    By jonesy29847 in forum Programming
    Replies: 3
    Last Post: 03-03-2011, 11:07 PM
  4. CurrentRecord Property Syntax
    By P5C768 in forum Programming
    Replies: 7
    Last Post: 05-13-2010, 03:58 PM
  5. access currentRecord
    By fdelval in forum Forms
    Replies: 2
    Last Post: 01-26-2010, 09:37 AM

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