473,418 Members | 4,847 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,418 software developers and data experts.

Controlling query criteria from an unbound form field

Hi all,

Unfortunately I am quite a novice with Access!! I've created a number
of data bases for my work however becuase my skills are limited to
really built in functionality and wizards my programs are not really
user friendly.

I have searched and searched and tried numerous times to get the
following right to no avail - and I think its really becuase of my
lack of understanding.

A little background to assist:

Goal of my database. We archive customer files - and they are
archived via a barcoded box. So essentially I have two tables and two
forms setup. One table contains records of the Barcoded boxes. The
other contains the all the files. They link & filter simply by
connecting the Barcode. Ie: you open the form for the box - then
click "show files" and it simply opens the second form filtering by
the Barcode.

Unfotunately when I create a new file record attached to a box - I
need to retype the barcode so I can be sure these mary up.
Pathetically simple I know - but I can live with that.

THE ISSUE. I then have a query that filters the file records table by
a given barcode. Attached to this is a report that runs from the
query (query is set to display data from both tables) and simply
displays all filtered files according to barcode.

What I want is for my main menu screen (unbound form - which contains
all the buttons to various forms & searches) to use an unbound field
to tell my query/report to filter by what I type in.

ie: (bank field - type barcode) [Press a button that opens the
filtered report]. thats it...

Right now, I have a button that opens the query. I then paste in the
barcode I want a report on. I hit save, close it and then open the
associated report.

To most of you guys the solution is probably incredibly simple, so
please don't laugh.

Please help!

Cheers
Dezzar!
Aug 22 '08 #1
7 12477
can no one help with this??
Aug 25 '08 #2
On Thu, 21 Aug 2008 20:47:05 -0700 (PDT), DeZZar <de**************@gmail.com>
wrote:
>Hi all,

Unfortunately I am quite a novice with Access!! I've created a number
of data bases for my work however becuase my skills are limited to
really built in functionality and wizards my programs are not really
user friendly.

I have searched and searched and tried numerous times to get the
following right to no avail - and I think its really becuase of my
lack of understanding.

A little background to assist:

Goal of my database. We archive customer files - and they are
archived via a barcoded box. So essentially I have two tables and two
forms setup. One table contains records of the Barcoded boxes. The
other contains the all the files. They link & filter simply by
connecting the Barcode. Ie: you open the form for the box - then
click "show files" and it simply opens the second form filtering by
the Barcode.

Unfotunately when I create a new file record attached to a box - I
need to retype the barcode so I can be sure these mary up.
Pathetically simple I know - but I can live with that.

THE ISSUE. I then have a query that filters the file records table by
a given barcode. Attached to this is a report that runs from the
query (query is set to display data from both tables) and simply
displays all filtered files according to barcode.

What I want is for my main menu screen (unbound form - which contains
all the buttons to various forms & searches) to use an unbound field
to tell my query/report to filter by what I type in.

ie: (bank field - type barcode) [Press a button that opens the
filtered report]. thats it...

Right now, I have a button that opens the query. I then paste in the
barcode I want a report on. I hit save, close it and then open the
associated report.

To most of you guys the solution is probably incredibly simple, so
please don't laugh.

Please help!

Cheers
Dezzar!
Open your query and in the criteria line under your barcode field instead of
typing the barcode in, put -

Forms!NameOfMenuForm!NameOfUnboundField

(replace names with your form/control names)

Now when you open the query/report it will use whatever value you have typed
into the unbound textbox as the criteria.

Obviously the menu form needs to be open at the time and a value entered into
the unbound control for it to return the correct records.
Wayne Gillespie
Gosford NSW Australia
Aug 25 '08 #3
Also:
if you open/run the query when that menu form is NOT open then Access
will open an input form asking for the value to be entered manually.

Ron
Aug 25 '08 #4
On Mon, 25 Aug 2008 05:34:39 -0700 (PDT), Ron2006 <ro******@hotmail.comwrote:
>Also:
if you open/run the query when that menu form is NOT open then Access
will open an input form asking for the value to be entered manually.

Ron
True. But it is bad interface design and likely to confuse the user.

Wayne Gillespie
Gosford NSW Australia
Aug 25 '08 #5
On Aug 25, 9:17*am, Wayne Gillespie
<best...@NObestfitSPAMsoftwarePLEASE.com.auwrote :
On Mon, 25 Aug 2008 05:34:39 -0700 (PDT), Ron2006 <ronne...@hotmail.comwrote:
Also:
if you open/run the query when that menu form is NOT open then Access
will open an input form asking for the value to be entered manually.
Ron

True. But it is bad interface design and likely to confuse the user.

Wayne Gillespie
Gosford NSW Australia
Wayne, I agree completely with your comment. I was just trying to
tell DeZZar what was going to happen if the query was executed when
the form was NOT open.

Ron.
Aug 25 '08 #6
Wayne,

Thank you so much for your help! Such a simple solution has opened up
a world of functionality!!

Much appreciated!!
Aug 26 '08 #7
On Aug 25, 10:27*pm, DeZZar <derrick.goost...@gmail.comwrote:
Wayne,

Thank you so much for your help! *Such a simple solution has opened up
a world of functionality!!

Much appreciated!!
Dezzar,

I use the method above a lot if your query is going to be hardcoded
and not reused.

But, sometimes you want that window to be opened by 2 different
forms. If that's the case, then hard coding a pointer in the query to
the form won't work.

Here's some other methods to consider for your toolbox.
1. Limiting records in your window.
Another fairly easy way is to trigger a filter based on the "after
update" of a text box, list box, or combo box. You use the me.filter
and me.filteron commands to set a filter and apply it. Check the help
files on these. (You'd think the filter and filteron methods would be
used when you create a wizard combo box with "Find a record on my form
based on the value I selected in my combo box". But, that just
creates a "FindFirst" in the AfterUpdate event.)

Basically, if you wanted to narrow the records on a results screen,
first create an unbound combo called "cmbRecordIDChooser" in your form
header with "RecordID" as the bound column. Then, you could enter
afterupdate code that looks like this:

dim strFilter as string
strFilter = "[RecordID] = " & me.cmbRecordIDChooser
me.Filter = strFilter
me.FilterOn = True

2. Use the "criteria" method to open a form/report.
The "Open" event for forms and reports contains an option called
"criteria". You can set the criteria just like strFilter is set above
when you run the Open command. (This code is used by the button
wizard when you make a button with the "Open the form and find
specific data to display" option.)

The button Wizard will create code in this format.
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmRecordDisplay"

stLinkCriteria = "[RecordID]=" & Me![cmbRecordIDChooser]
DoCmd.OpenForm stDocName, , , stLinkCriteria

3. Combine the 2 concepts.
Now, here's the trick. Why set something and then have a button to
click a separate time? There's NO reason you can't just use this code
in your combo box's after update event. Just cut and paste the Wizard
Code from the button into the Wizard Code for the dropdown. And,
boom.... Someone picks something in the combo box, and immediately,
your window pops up.

You can use these kind of methods in lots of "After Update" senarios -
text boxes, list boxes, etc.

In fact, I think it's one of the earliest ways I started using VBA
code.

Best of luck,

Jon
Aug 26 '08 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Steve | last post by:
Form FrmRestock's recordsource is QryFrmRestock. The TransactionDate field's criteria is set ats: Forms!FrmRestock!LastXDays. LastXDays on the form is a combobox where the selections are 30, 60...
3
by: John young | last post by:
I have been looking for an answer to a problem and have found this group and hope you can assist . I have been re doing a data base I have made for a car club I am with and have been trying to...
3
by: Cillies | last post by:
Does anyknow how to control dates in acess 2000, the thing is I want to search for records using a form by date. I will be using a between date search box. But i want to enter say todays date but...
6
by: Andy | last post by:
Hello, I am having many problems with setting up a parameter query that searches by the criteria entered or returns all records if nothing is entered. I have designed an unbound form with 3...
1
by: longtim | last post by:
I have been having endless difficulty creating reports/queries that set any relevent parameters from controls in forms. I am creating an application under access 2003 but will target access...
3
by: dskillingstad | last post by:
I'd appreciate any help I can get. I'm not sure what I'm doing wrong, but.... I've searched these groups for some solutions but no luck. I have an unbound form (frmSearch), with several unbound...
2
by: Mark Roughton | last post by:
I have a form where the users need to view records for various criteria, one of which is a date field on which they may wish to view all related data for the selected date, for all dates upto and...
8
by: Ragbrai | last post by:
Howdy All, I have a query that is used for filtering results to be used in a combo box. The query needs to test fields from both a table and then unbound text boxes on the form that also contains...
4
by: dizzydangler | last post by:
Hi all, I am a new Access user and just starting to get my head around some of the basic concepts, so please take it easy on me :) My company has been managing client records on excel, and I’m in...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.