Query Won't Work In A Form

Aug 1, 2007

hi

i have a DB which tracks order numbers,
the main table is a SQL table linked in, and there are lots of local tables as well, one of which is called userDetails and contains a field useremail

i want to open a form and only show records from trackermaindata that contain my useremail -


SELECT dbo_TrackerMainData.userEmail
FROM dbo_TrackerMainData, userDetails
WHERE dbo_TrackerMainData.userEmail=userDetails.useremai l;

when i double click this query in access it works and it shows me only my records, but when i try and run this query from a button (using a macro) in my form, it asks me to Enter Parameter Value userDetails.useremail


i've tried lots and lots of things so far and nothing works. i have lots of other queries which do work, but they don't reference another table - they either contain a static value or take their data from an entry box.

can anyone give any reason why this should not work? it seems straight forward enough!!

thanks for any help

View Replies


ADVERTISEMENT

Cannot Get Query To Work With My Date Select Form

Jan 5, 2006

With the imense help of some of the people in this forum, I have scraped together a nice little database.
There is one function, however, which is not working.

I have a query that should run from a form I have created. The form has multiple criteria and all seem to be working except for the date fields... "First Order" and "Last Order".
The way I have it set up is that I have a table of dates. The form has a list box of the dates (first of the month, for 4 years).
The source data in the form reads: SELECT [TDateSelect].[StartDates] FROM TDateSelect ORDER BY [TDateSelect].[StartDates]; (for each of the 2 "minimum" dates)
and SELECT [TDateSelect].[EndDates] FROM TDateSelect ORDER BY [TDateSelect].[EndDates]; (for each of the 2 "max" dates)
The user is allowed to select a date range for the first order and the last order. (4 dates altogether).

The form looks fine.

In the query, I have set the criteria for the last date as:
Between [Forms]![FSetOtherCriteria].[MinLast] And [Forms]![FSetOtherCriteria].[MaxLast]

When I run the query (even with a wide date range) I get no results. When I remove the dates from the query, or enter the limits manually, the query works like a dream.

Any ideas???

View 3 Replies View Related

Queries :: Cannot Get Crosstab Query To Work In A Form

Dec 30, 2013

When I run this query

TRANSFORM Sum([rpt LEAD TYPE SUCCESS RATE2].rec_cnt) AS SumOfrec_cnt
SELECT [rpt LEAD TYPE SUCCESS RATE2].Internal_Rep, [rpt LEAD TYPE SUCCESS RATE2].Lead, [rpt LEAD TYPE SUCCESS RATE2].Start_Date, [rpt LEAD TYPE SUCCESS RATE2].End_Date
FROM [rpt LEAD TYPE SUCCESS RATE2]
GROUP BY [rpt LEAD TYPE SUCCESS RATE2].Internal_Rep, [rpt LEAD TYPE SUCCESS RATE2].Lead, [rpt LEAD TYPE SUCCESS RATE2].Start_Date, [rpt LEAD TYPE SUCCESS RATE2].End_Date
PIVOT [rpt LEAD TYPE SUCCESS RATE2].Results;

I get valid results.

When I run the form it prompts me 3 times for each start date and end date. Then I get the following error :The Microsoft Access database engine does not recognize '' as a valid field name or expression.

I am running MS Access 2010 on a Window 7 pc.

View 10 Replies View Related

Forms :: Query Doesn't Work To Filter In Form

Nov 4, 2013

I've got a single form ("Lead Data") that has Cascading Combo boxes that work perfectly, entering data into "tblLeadData":cboMatterTypeIDcboMatterIDcboAttyIDcboPlglID Attorney & Paralegal are the people assigned to the Matter. My problem is in finding a way to allow a specific Attorney or Paralegal to filter for only his or her records. I made a query of tblLeadData that works perfectly as a query, but when I use it as a filter in an "on click" macro event, it doesn't work. I suspect it's because of the cascading combos, because I've successfully used this kind of query based macro filter in the past.

Okay, more on how it is set up. The same people are always assigned to a specific matter, so when you pull down the Atty & Plgl combo boxes, there's only one person. So it isn't a true Parent/Child relationship, but it's working. And there were two advantages of this set up over an autopopulate set up (which I considered): 1) When I change something in the reference tables (refAtty and refPlgl), it also changes in tblLeadData & 2) in case there's an exception to the usual assignment pattern, we can just leave Atty & Plgl blank and put the correct assignment in a text box called "AssignmentNotes."

So my query of tblLeadData that works, qryLeadDataAssign, uses the following fields:

tblLeadData.AttyID
refAtty.Atty
tblLeadData.PlglID
refPlgl.Plgl
tblLeadData.AssignmentNote
Expr1: [Atty] & " " & [Plgl] & " " & [LeadAssignmentNotes]Criteria: Like "*" & [Who?] & "*"

The Join Properties in the query between tblLeadData and refAtty is set to "2: Include ALL records from 'tblLeadData' and only those records from refAtty" where the joined fields are equal." And the same for Plgl.

When I run the query, it asks me a single time, "Who?", I put in the name and it pulls up all instances of the name from any of the 3 fields. It acts as a "contains" filter, not an "equals" one.

As for my cascading combos, here are the settingsMatterTypeIDRow Source:

SELECT refMatterType.MatterTypeID, refMatterType.MatterType, refMatterType.[MatterType] FROM refMatterType ORDER BY refMatterType.[MatterType]; On Change Event:Me.cboMatter.Requery
MatterIDRow Source: SELECT tblMatter.MatterID, tblMatter.Matter FROM tblMatter WHERE (((tblMatter.MatterTypeID)=[Forms].[LeadData].[cboMattertype])) GROUP BY tblMatter.MatterID, tblMatter.Matter, tblMatter.Matter ORDER BY tblMatter.Matter;
On Change Event:Me.cboAtty.Requery

[Code] ....

I put a button on the form and put an embedded macro as an "On Click" event. The macro is an "ApplyFilter" and the filter name is qryLeadDataAssign. When I click on the button, I am asked to enter

data 3 times:Enter Parameter Value: Atty
Enter Parameter Value: Plgl
Enter Parameter Value: Who?

Clearly, the expression in the query doesn't function in the button. And the result, no matter what I put in, is that all of the records are still there, although the filtered button is activated.

I tried putting the expression from the query into the macro builder window, but I for sure don't know what I'm doing there and haven't been able to make it work.

View 4 Replies View Related

Forms :: Criteria In Query Does Not Work With Navigation Form

Oct 23, 2014

how the Forms work I am trying to put some of them in Navigation Form and my commands does not work as they did in Form."Home app" is the navigation form, "Apeluri_neinchise" is the subform of "Home app" and "Combo1" is the criteria based on which a query shows a specific data.

What is the proper formula for query criteria?

[Forms]![Home app]![Apeluri_neinchise].[Form]![Combo1] (I tried this but it's not workink)

View 3 Replies View Related

Making A Look-Up Form Work The Way I Want It To Work!

Feb 27, 2006

We are creating a simple database to maintain driver license information for faculty, staff, and students who use cars from the university’s motor pool.

To do this, I have created two tables: tblDRIVER and tblLICENSE.

The fields in tblDRIVER are:
pkfDriverIndex
strLastName
strFirstName
strInitial
strAddress1
strAddress2
strCity
strState
strZIP
datBirthDate

The fields in tblLICENSE are:
pkfUpdateIndex
fkfDriverIndex
datDateUpdated
strState
strLicNumber
datExpirationDate
ynViolations
ynActive

Information about the driver is stored in tblDRIVER and the driver’s license information is stored in tblLICENSE. Periodically, we run a report that identifies drivers whose licenses are due to expire within a certain number of days. All this works fine.

My problem is that I am trying to create a lookup form that will load from a data entry form that will permit the Motor Pool Clerk to look up a driver by name and review the licensing information (which appears as a subform).

All this sort of works- I am using a combo box (based on a query) to look up a driver’s last name (which it does) and to populate all the driver’s information on the look-up form (including license information in a subform). Currently, the combo box locates the driver (including the unique index, last, and first names), and populates the form with first and last name but the rest of the information is not displayed on the look up form. Worse still, sometimes one driver’s last name matches up with the first name of the next driver listed in the table! This seems to happen only if a look up is attempted more than once. What gives.

Thanks for the help.

View 9 Replies View Related

Search Code Work On One Form But Not The Other Form?

Jul 18, 2015

* This code works to search frmMember for criteria found in tblMember:

Private Sub cmdSearch_Click()
If Len(cboSearchField) = 0 Or IsNull(cboSearchField) = True Then
MsgBox "You must select a field to search."
ElseIf Len(txtSearchString) = 0 Or IsNull(txtSearchString) = True Then
MsgBox "You must enter a search string."

[Code] ....

* But this next code which I have copied and Pasted to frmEventInput, then renamed the frm and tbl, retrieves the same criteria as the above (tblMember) instead of the tblEventInfo...

Private Sub cmdSearch_Click()
If Len(cboSearchField) = 0 Or IsNull(cboSearchField) = True Then
MsgBox "You must select a field to search."
ElseIf Len(txtSearchString) = 0 Or IsNull(txtSearchString) = True Then
MsgBox "You must enter a search string."

[code]...

What am I missing?

View 3 Replies View Related

Filter By Form Does Not Work

Apr 15, 2005

Hi,
I have a form which I can't seem to filter by form. When I click on "Filter by Form", the only combo option I get is "Is Null" or "Is Not Null", it does not give the full list in the table to choose. Can anyone tell me what's wrong with my form? The form also has a sub-form....does it matter?

I also tried tesing filtering the table with query but it also doesn't work.
My query,
SELECT DOCUMENT.TITLE
FROM DOCUMENT
WHERE (((DOCUMENT.TITLE) ALike "*work order*"));


Also, with Filter by form can I use wildcards such as entering in the search field of the form as "= "*work order*"

thanks,
Galantis

View 1 Replies View Related

In A Form, Some Dates Work, Some Don't

Jun 27, 2006

I've got a form with several date fields (in Medium date format), with each field bound to fields in a table, where also the dates are in medium format.

I also have the form set up where I can enter dates manually, or I can double-click and pick dates from a calendar form, or I can click on an icon and pick dates from the calendar form. Each date goes through the same bunch of processes (i.e., queries and code).

My problem: Some dates work, and some dates don't. On some date fields, I can key in a date, exit the form, re-open the form, and my dates show up (since they were processed into my table.) However, some other date fields do not get processed! I enter dates into these fields, exit the form, re-open the form, and there are no dates!!

I have checked all fields in my table..... they are all date fields, of medium date format. Same for my form.

Why would some dates work just fine while others don't work? If anyone has some suggestions I could try, I would be grateful. What might I look at in my application?

View 1 Replies View Related

Round With Neg Will Not Work In Query, Why?

Sep 22, 2005

In a query I have placed functions that work fine. Now I needed to round a currency number to the nearest $10. ex. 224.49 would be 220.00. I used round(xxxxxxx,-2). this gives me an error. positive 2 works fine. What's the deal? thanks for anyone who can help me. :)

View 3 Replies View Related

UCase Does Not Work In A Query

Oct 27, 2006

A few years ago, I wrote an application in Access 2000 that worked fine. Last year I upgraded to Access 2003. Everything works the same, but the UCase, Left and Right text functions give error messages when used in queries. Anyone have a way to fix this?::confused:

View 2 Replies View Related

VBA For Query Wont Work

Oct 3, 2007

Hi

I have set up a form to run a query, setting the following VBA to pick up values from the combo boxes in the form. The only problem is that I cant seem to get this working. When i press the command button it won't even get past the Dim db As Database line.

Private Sub Command10_Click()
On Error GoTo Errorhandler

Dim db As Database
Dim qd As QueryDef
Dim vWhere As Variant

Set db = CurrentDb()

On Error Resume Next
db.QueryDefs.Delete "qry_email2"
On Error GoTo 0

vWhere = Null
vWhere = vWhere & " AND [Status]=" + Me.cbostatustype
vWhere = vWhere & " AND [Substatus]=" + Me.cboSubstatus
vWhere = vWhere & " AND [PublicationName]=" + Me.cboPub1
vWhere = vWhere & " AND [PublicationName]=" + Me.cboPub2
vWhere = vWhere & " AND [PublicationName]=" + Me.cboPub3

If Nz(vWhere, "") = "" Then
MsgBox "There are no search criteria selected." & vbCrLf & vbCrLf & _
"Search Cancelled.", vbInformation, "Search Canceled."
Else
Set qd = db.CreateQueryDef("qry_email2", "SELECT * FROM tblgeneralcontactdetails WHERE " & _
Mid(vWhere, 6))

db.Close
Set db = Nothing

DoCmd.OpenQuery "qry_email2", acViewNormal, acReadOnly

Me.Command10.Requery
End Sub

help! I am now proper stuck with this.

Thanks in advance
Shapman

View 5 Replies View Related

Adding In Query Does Not Work

Nov 29, 2007

Im trying to add fields together in a query (these fields are results churned out by an iif expression), however access just concatenates the fields instead of summing. Access will not allow me to change the format of the original fields either.

Any ideas?

View 3 Replies View Related

Query Wont Work In VBA

May 5, 2008

I have a query that created using the query builder.
THis is the SQL

But this wont work when using it in the VBA Code Line
I know this is a syntax issue...

Any thoughts?


Code:UPDATE dbo_Core2 SET dbo_Core2.STORAGE_LO = "DESTROYED", dbo_Core2.[DATE] = forms!frm_Main!Combo0, dbo_Core2.DISPO = forms!frm_Main!Text3WHERE (((dbo_Core2.STORAGE_LO)=[forms]![frm_Main]![Combo7]));

View 10 Replies View Related

Form Suddenly Doesn't Work

Aug 26, 2004

I have a form that worked when I left work Tuesday. It is supposed to look at all the information in my "courses" table in descending order by year, ascending order by date, in edit mode. There is also a look-up list that allows me to select the date of the course and jump to that record.

I came in today and it doesn't work! The form LOOKS like it's in add mode--completely empty. the data is still in the table. I checked all the properties and they all look right. The query still looks like it did when I left. It just quit! When I use the look-up list the dates appear in the list, but nothing happens when I select it.

I know I'm not giving you much to go on, but any ideas?

View 1 Replies View Related

Getting A Hyperlink To Work When Clicked On A Form

Apr 8, 2015

I,m trying to get a hyperlink working on a form.I've used some code I copied from another access user I found online to browse for the required file. I can't open it though in form view. The link to the file is below.Also is there a way to display a hyperlink to the file as a symbol or e.g. ... (some full stops) to reduce the form box size and hide the complete file path.URL...

View 2 Replies View Related

Filter Query Wildcards Won't Work-pls Hlp

Jun 6, 2005

I'd be grateful if someone could offer some help with this to a frustrated Access novice : )

I have a query that filters records according to the value of an unbound text box in my form (basically search on last name)

I want to introduce wildcards into the filtering process but cannot get it to work.

Here's what I've done:

In the criteria field I had
[Forms]![MAIN]![Text440]
refering to the unbound text box on the form already mentioned.

This worked fine, but the following:
Like "*[Forms]![MAIN]![Text440]*" does not.

Nor does various combinations of brackets such as:
Like "*([Forms]![MAIN]![Text440])*"

In fact it now doesn't return anything, even if given a positive match. I have trawled help and the forums but to no avail. I have also tried the % character instead of *

I am using Access2000...

View 2 Replies View Related

CopyPaste SQL From Query Doesn't Work

Sep 27, 2005

If I copy paste the SQL from a query (View->SQL) to a macro it doesn't work.
Why?
I've tried removing quotes,Caps, adding quotes, parenthesis nothing worked.
Any ideas?

View 3 Replies View Related

Empty Cells Query To Not Work.

Apr 26, 2006

I have a Query pulling data from several tables. If there are empty cell with no data in them, they cause the Query to completely skip that record. It does not show up in the Query. Not practical since most of the data int the table will not be entered until some time later.

What gives? Is there a way around this?

Thanks.

View 1 Replies View Related

How To Get DateAdd In A Query To Work Through Other Fields?

Sep 6, 2006

Hi,

I am trying to get DATEADD to work in a query where the parts are called by different colums on the query like so:

Code:ExpiryDate: DateAdd("" & [DDType] & "",[DDNum],[Date])
At the moment the above will return the [DATE] without adding on the numbers

The [DDNum] is the number and works fine
The [Date] is the date and works fine

I know this becase the following code will give a new date
Code:ExpiryDate: DateAdd("d",[DDNum],[Date])

Could someone kindly let me know what I am missing in my syntax to get this working - I can get it working in ASP but I also need it to work in an Access Database

thank you for your time

View 2 Replies View Related

Modules & VBA :: Using Recordset To Work With Query

Dec 15, 2014

I want to use Recordset to work with query but get the error "Run-time error '3061' too less parameters. Expected one".

Code:
Dim rst As Recordset
Dim strSQL As String
Dim krojenie As String
strSQL = "SELECT * FROM powtorzeniaDoKrojenia"

[Code] .....

View 3 Replies View Related

Can't Work On Formula Field Query

Nov 20, 2014

I am trying to make a query using fields from multiple tables. I used the Expression builder to create it and it is a formula field where multiple table fields are involved. But whenever i run the query Access asks for a parameter value in a modal dialogue for the value of the fields. Is it because the field names has Square brackets around it? But access puts that automatically. How to make it work properly?

View 11 Replies View Related

General :: Started Form Doesn't Work?

May 24, 2015

I have a DB: This DB was sent to me via eMail (dropbox). It consist in a BE and 3 FEs. In each of the FEs I have a started form with some code activated by the Open event.

The issue: Access do nothing when I open the FEs. Note please that the DB is designed by me and it work very well on the user"s computers.

I use A2007 on Win7

The DB is in a trusted folder. Compact and Repair is not useful.

View 14 Replies View Related

Modules & VBA :: Switchboard Form Doesn't Work

May 27, 2014

I have developed a project in Access 2003 and it works absolutely fine. There is a switchboard form too and that works fine as well. But now in our company we are moving all the projects developed in 2003 to 2010. And so I have noticed the switchboard form doesn't work in Access 2010 the way it works in 2003. The Switchboard form doesn't display all the options in 2010.

View 5 Replies View Related

Queries :: LIKE Filter Does Not Work From A Form Field

Jan 14, 2015

I am attempting to use a form field as the source for a query filter criteria. Everything works fine if I simply use an "if equal" filter condition. As soon as I try a "like" condition, nothing works.

I created a test table with just one column (fld1). The table contains three records with the following values: BRDODS, BRD, TLAODS.

The following hard coded query returns two records, as it should.

SELECT Table1.fld1
FROM Table1
WHERE (((Table1.fld1) Like 'BRD*'));

I also created a test form (Form1) with just one text field (Text0). My intent is to soft code a criteria value via the form field instead of hard coding the query, as above. When I populate the form field with BRDODS, the following soft coded query returns one record, as it should.

SELECT Table1.fld1
FROM Table1
WHERE (((Table1.fld1)=[Forms]![Form1]![Text0]));

When I enter LIKE "BRD*" in the form field, no records are returned. I should get two records, just like the hard coded query above.

I've tried all variations of the LIKE statement in the form field, but nothing works.

View 8 Replies View Related

Query Forms Don't Work W/back-end Database

May 18, 2006

Goal: : To improve an application's performance by basing sub forms and combo

The application has a front and back-end. There is no SQL server involved. I use a module for, seeking out the back-end and automatically linking to the back-end in order that I might be able to provide updates. This has worked for me since first setting everything up.

First let me define what I mean by, “sub form” as to how I am designing my application. I have a number of, what I call, “main (unbound) forms” that are used to open up separate application modules. Each module contains a number of hyperlinks to each of the other application modules. Also, each main form (application module) contains a tab form with bound forms. Therefore, I am calling these lower level bound forms, sub forms and basing them on query files instead of tables. Many of the tables have fields for collecting information across a second form. I did not want to bring back all the fields when they are used in any of the two are three forms bound with the same table.

Problem: When I base either a main form or a sub-form on a query, that particular front-end query form no longer links to the back-end database table via a query file whenever I import everything g into a new/fresh version of the front-end application. Whnever I open one of the query files via the form, I get an error message in each of the fields indicating it can't fine the field even though the table is listed with all the fields. No, I do not have the same problem with forms based on tables.

I suspect that my problem is in what I am calling a main and sub form; and that the main form is really the first level bound form and never the top unbound form if one is used. I have a lot of forms. I just wanted to get some feedback on
my suspicions or find out what else could be the source of my problem before re-doing everything.

Thanks,
John

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved