Page 3 of 3 FirstFirst 123
Results 31 to 36 of 36
  1. #31
    danbo is offline Advanced Beginner
    Windows 7 32bit Access 2010 64bit
    Join Date
    Dec 2011
    Posts
    55

    Quote Originally Posted by pbaldy View Post
    Happy to help! I do have the "will code for beer" sign, so I'll take you up on that beer when you get to Nevada.
    Damnit, I spoke too soon. I didn't think about the fact that before i ran a macro that would take you to an existing record if one was there and in it's place I'm running an event proceedure on click and can no longer run the macro. Now, even if I want to look at an old record it opens based on the proceedure, new record.

  2. #32
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    I don't use macros, but this type of logic should handle both cases (presumes it's a numeric field):

    Code:
    If IsNumeric(Me.Text12) Then
      'Open form to existing record
    Else
      'Open to a new record and copy
    End If
    Here's the code equivalent of the macro to open the form to that record:

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

  3. #33
    danbo is offline Advanced Beginner
    Windows 7 32bit Access 2010 64bit
    Join Date
    Dec 2011
    Posts
    55
    Quote Originally Posted by pbaldy View Post
    I don't use macros, but this type of logic should handle both cases (presumes it's a numeric field):

    Code:
    If IsNumeric(Me.Text12) Then
      'Open form to existing record
    Else
      'Open to a new record and copy
    End If
    Here's the code equivalent of the macro to open the form to that record:

    BaldyWeb wherecondition

    That looks like a macro, right? how do I combine that with the current code I have on the "click" command.
    Can you give an example using my current code?
    Private Sub Text12_Click()
    DoCmd.OpenForm "Call Details", acNormal, , , acFormAdd
    Forms![Call Details].txtCID = Forms![Call history data]!navigationsubform.Form!ID
    Forms![Call Details].txtphone = Forms![Call history data]!navigationsubform.Form![phone home].Column(1)

  4. #34
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    No, that's VBA code, not a macro (though the two are often confused). Your existing code would go in the Else clause. The single DoCmd.OpenForm line from my link would go in the first part. Along the lines of:

    Code:
    If IsNumeric(Me.Text12) Then 
      DoCmd.OpenForm "Call Details", acNormal, , "IDFieldName = " & Me.Text12
    Else 
      DoCmd.OpenForm "Call Details", acNormal, , , acFormAdd
      Forms![Call Details].txtCID = Forms![Call history data]!navigationsubform.Form!ID
      Forms![Call Details].txtphone = Forms![Call history data]!navigationsubform.Form![phone home].Column(1) 
    End If
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #35
    danbo is offline Advanced Beginner
    Windows 7 32bit Access 2010 64bit
    Join Date
    Dec 2011
    Posts
    55
    Quote Originally Posted by pbaldy View Post
    No, that's VBA code, not a macro (though the two are often confused). Your existing code would go in the Else clause. The single DoCmd.OpenForm line from my link would go in the first part. Along the lines of:

    Code:
    If IsNumeric(Me.Text12) Then 
      DoCmd.OpenForm "Call Details", acNormal, , "IDFieldName = " & Me.Text12
    Else 
      DoCmd.OpenForm "Call Details", acNormal, , , acFormAdd
      Forms![Call Details].txtCID = Forms![Call history data]!navigationsubform.Form!ID
      Forms![Call Details].txtphone = Forms![Call history data]!navigationsubform.Form![phone home].Column(1) 
    End If
    Sorry I took so long to get back to you. I was writting a letter to the White House asking that they set a day aside to honor you as a HERO! Thanks again sooooo much. And I'm in Nevada often. I won't forget this. Thank you thank you thank you.

    Oh, and THANK YOU!

  6. #36
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    LOL! I'm glad we got it working for you.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Page 3 of 3 FirstFirst 123
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 12-04-2011, 09:11 PM
  2. Replies: 3
    Last Post: 11-16-2011, 01:56 PM
  3. Replies: 5
    Last Post: 11-11-2011, 11:06 AM
  4. Replies: 6
    Last Post: 11-05-2010, 10:11 AM
  5. copy info in subform as well as main form
    By Coolpapabell in forum Forms
    Replies: 0
    Last Post: 09-30-2009, 10:02 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