473,545 Members | 1,779 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Form that feeds a query

19 New Member
Hi, I am working with a form that is unbound and has text boxes the user can type in wildcard search critera which feeds a query. If I leave all the text boxes blank all query recoors are returned, however if i put a condition in any of the text boxes on the form and hit the command button to run the query the expected result is not returned. Is there a limit to the number of conditions a query can have going to a form? The sequel is noted below as to show how this is built, seems to almost work and I just can't figure out what the problem is. Any help would be appreciated.

SELECT tblPurchaseOrde rHdr.PO_Number, tblPurchaseOrde rHdr.Buyer, tblPurchaseOrde rHdr.OrderDate, tblPurchaseOrde rHdr.OrderDueDa te, tblPurchaseOrde rHdr.Vendor, tblPurchaseOrde rHdr.VenAddress 1, tblPurchaseOrde rHdr.VenCity, tblPurchaseOrde rHdr.VenState_P rov, tblShipToLocati ons.Name, tblPurchaseOrde rHdr.ShipTo, tblPurchaseOrde rHdr.ShipAddres s1, tblPurchaseOrde rHdr.ShipCity, tblPurchaseOrde rHdr.ShipState_ Prov, tblPurchaseOrde rHdr.ShipZip_Po stCode, tblPurchaseOrde rHdr.ShipContac t, tblPurchaseOrde rHdr.Comments, tblPurchaseOrde rHdr.FreightAnd Insurance, tblPurchaseOrde rHdr.Applicable Taxes, tblPurchaseOrde rHdr.Applicable Tariffs, tblRequisition.[OEM/MFG], tblRequisition. ModelNumber, tblRequisition. ModelPartNumber , tblRequisition. Description, tblRequisition. PO_Qty, tblRequisition. PO_UnitListCost Ea, tblRequisition. PO_UnitNetCostE a, [PO_Qty]*[PO_UnitNetCostE a] AS ItemExtendedCos t, tblPurchaseOrde rHdr.AccountApp ropiationNumber , tblPurchaseOrde rHdr.VendorQuot eRef
FROM (tblPurchaseOrd erHdr LEFT JOIN tblRequisition ON tblPurchaseOrde rHdr.PO_Number = tblRequisition. PO_ItemPONumber ) LEFT JOIN tblShipToLocati ons ON (tblPurchaseOrd erHdr.ShipAddre ss1 = tblShipToLocati ons.Address1) AND (tblPurchaseOrd erHdr.ShipCity = tblShipToLocati ons.City)
WHERE (((tblPurchaseO rderHdr.PO_Numb er) Like "*" & [FORMS]![frmPoCarReviewS elections]![PO_Number] & "*") AND ((tblPurchaseOr derHdr.Buyer) Like "*" & [FORMS]![frmPoCarReviewS elections]![Buyer] & "*") AND ((tblPurchaseOr derHdr.OrderDat e) Like "*" & [FORMS]![frmPoCarReviewS elections]![OrderDate] & "*") AND ((tblPurchaseOr derHdr.OrderDue Date) Like "*" & [FORMS]![frmPoCarReviewS elections]![OrderDueDate] & "*") AND ((tblPurchaseOr derHdr.Vendor) Like "*" & [FORMS]![frmPoCarReviewS elections]![Vendor] & "*") AND ((tblPurchaseOr derHdr.VenAddre ss1) Like "*" & [FORMS]![frmPoCarReviewS elections]![VenAddress1] & "*") AND ((tblPurchaseOr derHdr.VenCity) Like "*" & [FORMS]![frmPoCarReviewS elections]![VenCity] & "*") AND ((tblPurchaseOr derHdr.VenState _Prov) Like "*" & [FORMS]![frmPoCarReviewS elections]![VenState_Prov] & "*") AND ((tblShipToLoca tions.Name) Like "*" & [FORMS]![frmPoCarReviewS elections]![Name] & "*") AND ((tblPurchaseOr derHdr.ShipAddr ess1) Like "*" & [FORMS]![frmPoCarReviewS elections]![ShipAddress1] & "*") AND ((tblPurchaseOr derHdr.ShipCity ) Like "*" & [FORMS]![frmPoCarReviewS elections]![ShipCity] & "*") AND ((tblPurchaseOr derHdr.ShipStat e_Prov) Like "*" & [FORMS]![frmPoCarReviewS elections]![ShipState_Prov] & "*") AND ((tblPurchaseOr derHdr.ShipZip_ PostCode) Like "*" & [FORMS]![frmPoCarReviewS elections]![ShipZip_PostCod e] & "*") AND ((tblRequisitio n.[OEM/MFG]) Like "*" & [FORMS]![frmPoCarReviewS elections]![OEM/MFG] & "*") AND ((tblRequisitio n.ModelNumber) Like "*" & [FORMS]![frmPoCarReviewS elections]![ModelNumber] & "*") AND ((tblRequisitio n.ModelPartNumb er) Like "*" & [FORMS]![frmPoCarReviewS elections]![ModelPartNumber] & "*") AND ((tblRequisitio n.Description) Like "*" & [FORMS]![frmPoCarReviewS elections]![Description] & "*") AND ((tblRequisitio n.PO_Qty) Like "*" & [FORMS]![frmPoCarReviewS elections]![PO_Qty] & "*") AND ((tblRequisitio n.PO_UnitListCo stEa) Like "*" & [FORMS]![frmPoCarReviewS elections]![PO_UnitListCost Ea] & "*") AND ((tblRequisitio n.PO_UnitNetCos tEa) Like "*" & [FORMS]![frmPoCarReviewS elections]![PO_UnitNetCostE a] & "*") AND ((tblPurchaseOr derHdr.AccountA ppropiationNumb er) Like "*" & [FORMS]![frmPoCarReviewS elections]![AccountAppropia tionNumber] & "*") AND ((tblPurchaseOr derHdr.VendorQu oteRef) Like "*" & [FORMS]![frmPoCarReviewS elections]![VendorQuoteRef] & "*"));
Jun 1 '07 #1
3 1368
maxamis4
295 Recognized Expert Contributor
to answer your first question: No sql does not have a limit. Could you please explain how your user made this query? If you are making a dynamic query then you need to generate it from scratch with only the variables you are using. Example:


YOUR FORM
*************** *************** *************** ****
Listbox1 field1, field2, field3
Listbox2


Button1 (All) = "*"
DropdownList = table1, table2, table3
*************** *************** *************** ****

you selected field1 and field 3 from your list box into listbox2.
Then you clicked on button 1 and then you selected from the dropdown list table1

your result is this query "Select field1, field2 * from table1"

this can all happen in vb. I hope this helps a little.
Jun 1 '07 #2
mtrcct
19 New Member
Hi, thanks for the feedback. Actually, I made the query and it simply pulls data from the tables I noted in the sql. I have the query going to my form to receive the imput from the user and it is supposed to perform a wildcard search on the fields noted. The form is unbound and contains all unbound text boxes, nothing fancy, so after the selections are made there is a command button on the form that runs the query I described.

I don't get erros, but it does not bring back the complete record set it should, almost like there is something else filtering it....What do you think???

to answer your first question: No sql does not have a limit. Could you please explain how your user made this query? If you are making a dynamic query then you need to generate it from scratch with only the variables you are using. Example:


YOUR FORM
*************** *************** *************** ****
Listbox1 field1, field2, field3
Listbox2


Button1 (All) = "*"
DropdownList = table1, table2, table3
*************** *************** *************** ****

you selected field1 and field 3 from your list box into listbox2.
Then you clicked on button 1 and then you selected from the dropdown list table1

your result is this query "Select field1, field2 * from table1"

this can all happen in vb. I hope this helps a little.
Jun 4 '07 #3
mtrcct
19 New Member
Hi, before anyone spends any more time on this I got the query to operate properly. After review of the first reply sent to me I regarding any limits the sql could have, I went back and cleared all the code in the query and added each statement in one at a time and now it works fine. I never found the problem, the only thing I can think of is there may have been some embedded characters in a few statements since I coppied and pasted on the first go around and then went back to change the control names.

Thanks for the feedback...It did help me out...
Jun 4 '07 #4

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

Similar topics

25
10179
by: Lyn | last post by:
Hi, I am working on a genealogy form. The only table (so far) lists everybody in the family, one record per person. Each record has an autonum ID. The parent form (frmMainForm) displays the data in each record, which includes the ID of the father and the mother (who also have records in the table). One record per form. I have a Tab...
6
2791
by: fumanchu | last post by:
I've got to let end users (really just one person) load billing batch files into a third party app table. They need to specify the billing cycle name, the batch name, and the input file name and then I can use these values to execute a SQL Server stored procedure to load them into the batch table from the input file (the stored procedure uses...
2
1696
by: doctorfeelyg | last post by:
Hi there, I’m relatively new to access so please forgive any ignorance. Here is my, rather long-winded, plea for help: I have a main table which contains a list of ‘projects’ and associated information (team name, staff member dealing with a particular project, project description, budget etc). Team names and staff names are stored in...
2
1516
by: sbitaxi | last post by:
I have a query that performs a simple sum, a running total essentially. I want to be able to use that in a calculation in a form but I can't seem to get it to display anything beyond #Name? Structure - Table A feeds the primary form, recording particulars about a mailing and calculating costs Table B feeds a sub-form, line items to track...
4
1615
by: prufrock | last post by:
Hi I have a form to feed a query which then runs a report. I want to be able to produce a report based on the first letter e.g. P. I can type in Like "P*" in criteria and the query works fine. I have a form with a combo box to make running the report easier. the table the combo feeds from has a record for each "P*", etc. I have set up !...
8
1547
JustJim
by: JustJim | last post by:
Imagine if you will, a beautifully designed and normalised database application. OK that's enough. On to my database application! I envisage a form with multiple combo-boxes feeding a query so that the operator can activate the query (it feeds a report not that that matters) with the selections ANDed together and just see the required...
4
1534
by: Menelomie | last post by:
I have spent more time than I am willing to admit trying to figure this out... I'm trying to use a form to manage the criteria in a query. This one query feeds to numerous other append queries as part of a monthly maintenance process. The query that I'm updating basically needs to be changed each month to reflect the current month. I'm...
4
5522
by: Susan Bricker | last post by:
I have a form that displays record information in Continuous Record display (scrollable list). One of the fields in the record is an Integer value called "rcode" (reason code). But, I don't want to display the reason code integer value. I want to display the reason code descriptive text (string data). So I have a TEXT BOX object on the...
7
13493
kcdoell
by: kcdoell | last post by:
Hello: I have a continous form that displays various forecasting records that an End user can add or edit the records (this feeds off of a query that I created called "ReQryForecast"). On that form, in the top corner, I placed 4 unbound text boxes that displays summary information. On one of them, "TxtBudGWP" I want to display the specific...
1
7411
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...
0
7749
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...
0
5965
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5322
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...
0
4942
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...
0
3444
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...
1
1871
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
1
1012
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
695
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.