Results 1 to 9 of 9
  1. #1
    Cedarguy is offline Advanced Beginner
    Windows Vista Access 2010 32bit
    Join Date
    May 2012
    Posts
    37

    Need to pass a value from one form to another

    Help please.

    I have a Form (datasheet) based on a query; the Form lists tasks
    Each entry has a button beside it which is used to create a follow up task
    I am able to open a new Form using the button via a macro but can't figure out how to pass the "account id" so the follow up task is created for the same account
    I tried using temporary variable in the macro but obviously need help as the value isn't getting through.

    Thanks

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    The easiest approach is form/subform arrangement. Otherwise need code and there are several ways to do this. I use only VBA. Code in the second form Current event:

    Where does the AccountID come from? Is it somewhere on the first form?

    If Me.NewRecord Then
    Me!AccountID = Form_firstformname.AccountID
    End If
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Quote Originally Posted by Cedarguy View Post

    ...I have a Form (datasheet) based on a query...

    ...Each entry has a button beside it which is used to create a follow up task...
    I run v2007, but I like to keep up on the new things with versions 2010/2013, so I have to ask...are Command Buttons now available on Datasheet View Forms?

    Linq ;0)>

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Good catch, linq, I missed that.

    No, they are not with 2010.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Cedarguy is offline Advanced Beginner
    Windows Vista Access 2010 32bit
    Join Date
    May 2012
    Posts
    37
    Quote Originally Posted by Missinglinq View Post
    I run v2007, but I like to keep up on the new things with versions 2010/2013, so I have to ask...are Command Buttons now available on Datasheet View Forms?

    Linq ;0)>

    Sorry, that was my mistake. I should have said "multiple items" form instead of datasheet.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Does suggestion in post 2 resolve issue?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    Cedarguy is offline Advanced Beginner
    Windows Vista Access 2010 32bit
    Join Date
    May 2012
    Posts
    37
    First, thank you for your reply.

    The account id is on the query behind the calling form. BTW, I got the macro working with tempvars; it appears I wasn't replenishing it in the called form.
    I'm not too proficient with VBA so try to stick with the canned solutions as much as I can.
    Now I'm stuck on date. Using tempvars, I want to take the date on the calling form and make it 90 days hence and store it on the called form; should be simple but I'm limited by syntax issues.

    Thanks.

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Set a TempVars for the date with expression: [date field] + 90

    What syntax issues?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    Cedarguy is offline Advanced Beginner
    Windows Vista Access 2010 32bit
    Join Date
    May 2012
    Posts
    37
    Too embarrassed to mention the stupid mistake I made. Thank you again. I'm good for now

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

Similar Threads

  1. Replies: 6
    Last Post: 10-17-2014, 09:38 AM
  2. Replies: 8
    Last Post: 05-10-2012, 10:57 AM
  3. pass value from one form to another
    By ManC in forum Forms
    Replies: 7
    Last Post: 11-25-2011, 09:59 AM
  4. Pass Value to Form
    By JohnBoy in forum Programming
    Replies: 5
    Last Post: 06-06-2010, 11:26 AM
  5. Pass a value from a form to another
    By cwwaicw311 in forum Forms
    Replies: 3
    Last Post: 03-16-2010, 12:42 AM

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