Retaining Parameter Input Value for Future Use

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kjworm
    New Member
    • Nov 2006
    • 26

    Retaining Parameter Input Value for Future Use

    Hello everyone. I have a parameter query that I would like to retain the parameter value for future use. What I would like to do is have the user perform the query, select the distinct result that they are looking for. Once they have finished with this particular record, I would like to reopen the query by using a command button but not require the user to reenter their original parameter. I have tried the code below but am not sure if this would work:

    Code:
        Dim stLinkOne As String
        Dim stLinkTwo As String
        Dim stLinkThree As String
        Dim stDocName As String
        
        stDocName = "frmEntryView"
        stLinkOne = "[ProjectCode]=" & Me.sfrmTmLdrSort.Form.ProjectCode
        stLinkTwo = "[TeamLeader]='" & Me.sfrmTmLdrSort.Form.Team_Leader & "'"
        stLinkThree = stLinkOne & " AND " & stLinkTwo
        
        DoCmd.OpenForm stDocName, , , stLinkThree
    [TeamLeader] is the parameter and [ProjectCode] is the primary key that links multiple tables.

    Thanks!
  • missinglinq
    Recognized Expert Specialist
    • Nov 2006
    • 3533

    #2
    Everything else aside,
    I have tried the code below but am not sure if this would work
    doesn't make any sense at all; if you've tried the code out you should know whether or not it works!

    To be honest, I don't see how the code posted could possibly accomplish the task you've set forth! Maybe NeoPa or Mary McCarhty can shed some light!

    Comment

    • kjworm
      New Member
      • Nov 2006
      • 26

      #3
      You should not have wasted either of our time with your reply.

      Of course I have tried the code and it doesn't work. I guess that I should have said something like "I'm not sure if this method will work or not, or if there is a better way".

      Thanks for suggesting absolutely nothing but an insult.

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32661

        #4
        Firstly, please don't resort so quickly to flaming here kjworm.
        I appreciate that you weren't impressed by missinglinq's reply - I suspect that they are starting to get to grips with the frustrations of trying to understand what people post as questions. When you've contributed as much as they have, you may start to understand the frustration.

        MODERATOR

        Anyway, on to your question.

        I'm not sure that parameter queries is a relevant concept here.
        You want to 'remember' a previous selection(s) on a form rather than anything directly related to the query.
        If I'm right in my supposition then you would probably benefit from defining a global variable (in a normal module) :
        Code:
        Public stLink3 As String
        You can then refer to this after the form is closed or, indeed, anywhere within the current session.
        Please let me know if this idea is helpful or if you require more help or clarification.

        Comment

        • MMcCarthy
          Recognized Expert MVP
          • Aug 2006
          • 14387

          #5
          Originally posted by kjworm
          You should not have wasted either of our time with your reply.

          Of course I have tried the code and it doesn't work. I guess that I should have said something like "I'm not sure if this method will work or not, or if there is a better way".

          Thanks for suggesting absolutely nothing but an insult.
          kjworm,

          I'm sure it wasn't intended as an insult it's just that it can be difficult for experts to understand the question you are asking. missinglinq is just experiencing the frustration all experts go through at times because it can be difficult sometimes for people without a lot of experience to express their problem in the short format available to us. Therefore the expert can't understand the question and therefore can't answer it.

          You would be surprised how many posters don't try out code before posting their questions here and the fact that this doesn't include you is great.

          The experts volunteer their time and can be very helpful but they are also only human and can experience frustration just as much as anyone else.

          Try not to take offence so quickly.

          MODERATOR

          Comment

          Working...