473,748 Members | 10,649 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 12507
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,

Unfortunatel y 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!NameOfMen uForm!NameOfUnb oundField

(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******@hotma il.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...@NObest fitSPAMsoftware PLEASE.com.auwr ote:
On Mon, 25 Aug 2008 05:34:39 -0700 (PDT), Ron2006 <ronne...@hotma il.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.comwro te:
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 "cmbRecordIDCho oser" 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.cmbRecordIDC hooser
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 = "frmRecordDispl ay"

stLinkCriteria = "[RecordID]=" & Me![cmbRecordIDChoo ser]
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
4986
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 and 90. The default is set at 30. Question1: When the form opens, there are no records displayed although there are many records that fit the criteria of 30. If I put a button on the form to do a requery and press the button, all the records...
3
579
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 make a query that selects from a table as desribed below .. I have a table (Volunteer) that has a member field (memnumber) and a number of fields that are headed in various categories and are yes/no formated
3
1919
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 retrieve the results for exactly one month later. E.G. I if I enter 10-05-04 to 14-05-04 I want to see the records for exactly 30/31 days later. I was thinking could I manipulate the "Today'sDate" function + 30days.
6
7137
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 fields on it: Date (DateSpan1 and DateSpan2), Originator, and GroupName. I have added a button that triggers a query and uses those fields as its parameter criteria to populate a form. The user must be allowed to either enter all of the
1
2914
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 2000. The access file is in access 2000 format. I have a form that will hold the relevent parameters for the query/report that reports the statistics for all job records that match a certain criteria. These are: - A Customer Name.
3
1979
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 text boxes on it and a command button bound to a macro which fires off a parameter query based on the criteria/string that the user types into the text boxes on frmSearch. My goal is to create a search form where the user can search by any of...
2
5738
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 icluding the selected date or all records on or after the selected date The user selects either "=", >=" or "<=" from a combo box and then a date from another combobox. The combination of thse two choices is then set in an unbound textbox so...
8
6415
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 the combo box. The fields I am working with are date fields that are formated as Short Date. I have written an IIF statement and placed it within the Criteria section of the Date field that I am trying to filter by. The current IIF statement works...
4
9498
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 the process of migrating the data over to Access 2007 (Windows XP), kind of learning as I go. I’ve managed to import the client records into a single table, and set up a “single view” form that streamlines how we input new client data. Now I’m...
0
9541
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9370
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9321
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9247
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6796
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6074
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4602
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4874
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3312
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.