'Update Query' Activation Problem

C

Chip

Hi, I am just learning ACCESS so this may be an easy
fix.

I have built a FORM that has a button to activate two
2 "update queries" but what i need is the form to have a
text box that the user inputs the Year and the queries
will be filtered by the year in the text box. I have
tried everything but cannot get anything to work.

Can anyone help? As Always, THANKS IN ADVANCE!!!

Here is the script that I use to activate the "update
queries" :


Dim stDocName As String

stDocName = "qry_SicUsed"
stDocName2 = "qry_VacUsed"

DoCmd.OpenQuery stDocName, acNormal, acEdit
DoCmd.OpenQuery stDocName2, acNormal, acEdit
 
F

fredg

Hi, I am just learning ACCESS so this may be an easy
fix.

I have built a FORM that has a button to activate two
2 "update queries" but what i need is the form to have a
text box that the user inputs the Year and the queries
will be filtered by the year in the text box. I have
tried everything but cannot get anything to work.

Can anyone help? As Always, THANKS IN ADVANCE!!!

Here is the script that I use to activate the "update
queries" :

Dim stDocName As String

stDocName = "qry_SicUsed"
stDocName2 = "qry_VacUsed"

DoCmd.OpenQuery stDocName, acNormal, acEdit
DoCmd.OpenQuery stDocName2, acNormal, acEdit

Add an unbound text control to the form.

Then change each query by adding a new column to the query grid:
ForYear:Year([DateFieldName])

On this column's criteria line, write:
forms!FormName!ControlName

You can uncheck the Show check box if you wish.

When ready to run either query, enter the year wanted in the control.
When you click the command button, the records returned by the query
should only be for the year selected.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top