473,324 Members | 2,511 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Variable from Parameter Query

Is there a way to assign the data from and Input box of a parameter query to a variable?

Here's the parameter for the query;
((DatePart('ww',[dbo_Hse.ExpDate],2,2))=[Enter Week Number]))
I would like to assign the "Week Number" the user enters to a variable.

Thanks for any and all suggestions

Gil
Aug 19 '10 #1
4 1686
Delerna
1,134 Expert 1GB
Edit the query and in the criteria for that field
type
[Please Enter The Week Number]

the query will treat that as a field name that doesn't exist and will popup a message box asking for it's value to be entered


I will let you figure out how to apply that to your expression.
It is quite easy if you think about it
Aug 20 '10 #2
I'm must be missing something, My query works as expected
It prompts me for the week number and returns the data I need. What I need is to assign that week number that was just used in the query to a variable.
I need use the same week number to check for records in a table before I appended new records.
I hope this makes sense.

Thanks
Gil
Aug 23 '10 #3
Jerry Maiapu
259 100+
Create a text box on form so that user's can enter the week number from the form. That value can be access by the query to filter the query records.

Hereafter you can store the text value in a variable (using Vba).

To achieve this, replace
Expand|Select|Wrap|Line Numbers
  1. [Please Enter The Week Number]
in the query by
Expand|Select|Wrap|Line Numbers
  1. Forms![Your Form name]![the text box name]
.

Create a cmd button on the form so that when clicked can open/run the query based on the week no value entered.

Something like:

Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenQuery "Your query name", acViewNormal
Hope this helps
Aug 23 '10 #4
Delerna
1,134 Expert 1GB
Edited: I realised I wasn't understanding the question.

I think you will need to supply a more detailed description of what you are trying to do. As Jerry is alluduing to, you will probably need to do it through VBA but you don't supply enough detail to give a fuller answer.
Aug 23 '10 #5

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

Similar topics

2
by: Michelle | last post by:
Hi all, I have a query that scans huge table consists of 8 or more millions records. The funny thing is that if I use the query with local variable, the query takes more than 1 minutes,...
5
by: MX1 | last post by:
Simpler way to ask question from my previous post. I wrote a query and it has a paramter field in it. I want to enter a date with the current year. If it I put in 6/30/2003, it works great. If I...
1
by: Cory | last post by:
When I run the subroutine testEmailContacts the msgbox says that there is only 1 record. The sql for qyEmailContactsQyCard is below. There is over 3000 records in the table "tbl:Contact". What am i...
1
by: carrionk | last post by:
Hi, I have created a Subform which SourceObject is a parameter query. This is the Query: Qry Name:80IsscomProduct SELECT * FROM Isscomp28 WHERE Like ;
1
by: Bill | last post by:
Hi, Our database is Access (i know, i would be better to use Mysql, but at the present time, it's access ...) and i created a parameter query (like a stored procedure in Mysql) for...
1
by: john_stivenson | last post by:
I have a subform whose source is a parameter query. How can I programatically change query parameters and refresh subform without showing "Enter Parameter Value" dialog?
0
by: AP | last post by:
I use the following snippet to open a build a querydef. This works great with a query that has a parameter that points to a form, but if I try to use it in a parameter query, even if the parameter...
1
by: jmarr02s | last post by:
When I double click on my form..I get a Parameter Query box. How can I turn this off?! I went to properties, but did not see anything that would help remove this. I also deleted the query...
3
by: limperger | last post by:
Hello everyone: This question is neither urgent nor important, but I post it just in case anyone knows (and wants to give a reply, of course XD). I have little idea of VBA, but I have dared to...
4
by: chicane | last post by:
I am currently writing a query in Access. I need to set up a parameter query for three fields which are called Status (text field), Authorised (date field) and Legal notices (date field). I need...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.