By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,469 Members | 2,271 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,469 IT Pros & Developers. It's quick & easy.

Retaining Parameter Input Value for Future Use

P: 26
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:

Expand|Select|Wrap|Line Numbers
  1.     Dim stLinkOne As String
  2.     Dim stLinkTwo As String
  3.     Dim stLinkThree As String
  4.     Dim stDocName As String
  5.  
  6.     stDocName = "frmEntryView"
  7.     stLinkOne = "[ProjectCode]=" & Me.sfrmTmLdrSort.Form.ProjectCode
  8.     stLinkTwo = "[TeamLeader]='" & Me.sfrmTmLdrSort.Form.Team_Leader & "'"
  9.     stLinkThree = stLinkOne & " AND " & stLinkTwo
  10.  
  11.     DoCmd.OpenForm stDocName, , , stLinkThree
[TeamLeader] is the parameter and [ProjectCode] is the primary key that links multiple tables.

Thanks!
Dec 14 '06 #1
Share this Question
Share on Google+
4 Replies


missinglinq
Expert 2.5K+
P: 3,532
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!
Dec 14 '06 #2

P: 26
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.
Dec 14 '06 #3

NeoPa
Expert Mod 15k+
P: 31,186
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) :
Expand|Select|Wrap|Line Numbers
  1. 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.
Dec 15 '06 #4

MMcCarthy
Expert Mod 10K+
P: 14,534
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
Dec 15 '06 #5

Post your reply

Sign in to post your reply or Sign up for a free account.