473,396 Members | 1,838 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,396 software developers and data experts.

Is ANSI 92 affecting my query parameters?

44
Hi all;
Here's one for you. I have a form open (let's call it frmMyForm) which contains a text box (txtMyText). The contents of this text box is passed to a parameter query as:

Expand|Select|Wrap|Line Numbers
  1. [forms]![frmMyForm]![txtMyText]
Exactly as it says so in the book, so to speak. But it's not working. It seems to be looking at the form, at least it doesn't ask me to enter the value manually, but the query doesn't return any results.

I can manually type the value I'm looking to pass over straight into the criteria box and it works. I can use [Enter parameter value:] in the criteria section, the dialog pops up, I enter the parameter there, and it works. But getting the value from a form (yes, the form is open at the time) doesn't. The only thing I can think of is that the database is set to ANSI-92 syntax, could this have something to do with it?

Thanks all, this is driving me nuts!
Apr 17 '09 #1
9 1840
Whizzo
44
Sorry folks, that was a fib. When I put the criteria in as
Expand|Select|Wrap|Line Numbers
  1. [forms]![frmMyForm]![txtMyText]
a dialog pops up at runtime and asks me for the very same parameter that I'm trying to pass, i.e. the string in txtMyTest. Maybe that helps?
Apr 17 '09 #2
FishVal
2,653 Expert 2GB
Post your query SQL.
Apr 17 '09 #3
Whizzo
44
Haha, you asked for it!

Expand|Select|Wrap|Line Numbers
  1. SELECT DISTINCT [perscustforename] & " " & [PersCustSurname] & [BUSCompanyname1] & " " & [Buscompanyname2] AS Name, tblCustomers.CustID, tblCustomers.TotalExposure, tblCustomers.SumAssured, tblPolicies.PolicyNumber, tblPolicies.PolicyIssuerName, tblPolicies.PolicyHolder, tblPolicies.SumAssuredValue, tblPolicies.CollStatus, tblPolicies.MaturityDate, DateDiff("yyyy",#5/5/2009#,[MaturityDate]) AS [Term Remaining], tblPolicyCompaniesData.PolicyNumber AS [COMP Policy Number], tblPolicyCompaniesData.PolicyCompany AS [COMP Policy Issuer], tblPolicyCompaniesData.PolicyStatus AS [COMP Policy Status], tblPolicyCompaniesData.PolicyMaturityDate AS [COMP Policy Maturity], IIf([PolicySumAssuredLife1]>[PolicySumAssuredLife2],[PolicySumAssuredLife1],[PolicySumAssuredLife2]) AS [COMP Sum Assured], [policyholdername1] & " " & [policyholdername2] AS COMPPolicyHolderNames, tblPolicyCompaniesData.PolicyStatus AS COMPPolicyStatus, IIf(IsNull([PolicyBanksInterestNoted?] And tblPolicyCompaniesData!PolicyNumber),"NO",[PolicyBanksInterestNoted?]) AS [Noted?], DateDiff("yyyy",#5/5/2009#,tblPolicyCompaniesData!PolicyMaturityDate) AS [COMP Term Remaining], Max(tblAccounts!AdvisorBnos & " " & tblAccounts!StaffAssignedToAdvisor) AS [Advisor details], tblCustomers.CustTypeRefined, Max(tblAccounts.AcctHoldingBranch) AS MaxOfAcctHoldingBranch
  2. FROM (tblCustomers LEFT JOIN tblAccounts ON tblCustomers.CustID = tblAccounts.CustID) LEFT JOIN (tblPolicies LEFT JOIN tblPolicyCompaniesData ON tblPolicies.PolicyNumber = tblPolicyCompaniesData.PolicyNumber) ON tblCustomers.CustID = tblPolicies.CustID
  3. GROUP BY [perscustforename] & " " & [PersCustSurname] & [BUSCompanyname1] & " " & [Buscompanyname2], tblCustomers.CustID, tblCustomers.TotalExposure, tblCustomers.SumAssured, tblPolicies.PolicyNumber, tblPolicies.PolicyIssuerName, tblPolicies.PolicyHolder, tblPolicies.SumAssuredValue, tblPolicies.CollStatus, tblPolicies.MaturityDate, DateDiff("yyyy",#5/5/2009#,[MaturityDate]), tblPolicyCompaniesData.PolicyNumber, tblPolicyCompaniesData.PolicyCompany, tblPolicyCompaniesData.PolicyStatus, tblPolicyCompaniesData.PolicyMaturityDate, IIf([PolicySumAssuredLife1]>[PolicySumAssuredLife2],[PolicySumAssuredLife1],[PolicySumAssuredLife2]), [policyholdername1] & " " & [policyholdername2], tblPolicyCompaniesData.PolicyStatus, IIf(IsNull([PolicyBanksInterestNoted?] And tblPolicyCompaniesData!PolicyNumber),"NO",[PolicyBanksInterestNoted?]), DateDiff("yyyy",#5/5/2009#,tblPolicyCompaniesData!PolicyMaturityDate), tblCustomers.CustTypeRefined, tblAccounts.AdvisorBnos, tblAccounts.StaffAssignedToAdvisor
  4. HAVING (((Max(tblAccounts.AcctHoldingBranch))=[Forms]![frmReportGenerator]![cboBranchName]))
  5. ORDER BY tblCustomers.CustID;
I can do basic modifications to SQL code but I'm still a noob when it comes to writing fresh stuff for myself. I'm still using the Query Builder in Access I'm afraid. I take it it's the HAVING section that's not working properly? The parameter in the Builder is expressed exactly how Microsoft and pretty much everywhere else I've looked tells me it should be, so I wonder what the problem is? As I said, the DB is using ANSI 92 so there may be subtle differences in syntax to the standard Access SQL. Any ideas?
Apr 17 '09 #4
FishVal
2,653 Expert 2GB
Ok.

Post please:
  • tblAccounts.AcctHoldingBranch field parameters (particularly datatype)
  • [Forms]![frmReportGenerator]![cboBranchName] properties: RowSource, ColumnCount, BoundColumn
Apr 17 '09 #5
Whizzo
44
Here's your info FishVal, thanks for taking in interest!

tblAccounts.AcctHoldingBranch field is a:
Text field, all characters forced to uppercase.

cboBranchName row source is:
Expand|Select|Wrap|Line Numbers
  1. SELECT tblBranchList.[Sort Code], tblBranchList.[Branch Name] FROM tblBranchList ORDER BY [Branch Name];
Bound col. 1
Table col 1. Sort code
Table col 2. Branch name

Interesting. Hadn't thought of that...
Apr 17 '09 #6
Whizzo
44
And there it is. I tried the criteria with a text box instead of a combo and it worked. Then I changed the bound column for the combo box and it started behaving itself. Happy days! I always thought that if you addressed a control in a form it always picked the data from the control and ignored bound columns etc. Ah well, one lives and learns. Thanks folks!
Apr 17 '09 #7
FishVal
2,653 Expert 2GB
You are welcome.

Best regards,
Fish.
Apr 17 '09 #8
NeoPa
32,556 Expert Mod 16PB
@Whizzo
I think to clarify, it would help to explain that the Sort code is the value being checked in the SQL, as it is the bound column of the ComboBox control.

I expect that the only column visible to the operator is the Branch name, so naturally the assumption is that it would compare it with that. No!

This is a problem that's fallen over frequently, and is even more confusing when ComboBoxes are used to show fields within the design of a table.
Apr 17 '09 #9
NeoPa
32,556 Expert Mod 16PB
In case it helps anyone finding this thread looking for ANSI-92 related problems, here are a few relevant links :
ANSI Standards in String Comparisons
Quotes (') and Double-Quotes (") - Where and When to use them
Using "&" and "+" in WHERE Clause
Apr 17 '09 #10

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

Similar topics

22
by: Canonical Latin | last post by:
#include<iostream> int main() { char buff; std::cin.getline(buff,3); std::cin.getline(buff,3); std::cout << buff << endl; } Run at command prompt and input 1234567 what do you get as output?
5
by: Paul Reddin | last post by:
Hi, using ROWNUMBER() is affecting the plan of a view very badly... is there a way of writing the following view to ensure rownumber() is done as the last thing done? i.e after the calling...
3
by: Ryan Hubbard | last post by:
I would like to run a query from VBA. The query will be one with parameters. Is there a way to run the query and have Access prompt for the values like it does if I where to execute it through...
100
by: Roose | last post by:
Just to make a tangential point here, in case anyone new to C doesn't understand what all these flame wars are about. Shorthand title: "My boss would fire me if I wrote 100% ANSI C code" We...
13
by: Roy Hills | last post by:
I've seen two different function prototype formats used for ANSI C, and I'm unsure as to which is the correct or preferred one. 1st Format (this is what I use) type function(type, type, type);...
1
by: Philip Bondi | last post by:
Hello to all SQL Server junkies who work with non-English characters: For people running scripts from the command line using ANSI files with special characters, it is very important to use isql...
9
by: Kelii | last post by:
I've been trying to get this piece to work for a few hours, but have given up. I hope someone out there can help, I think the issue is relatively straightforward, but being a novice, I'm stumped....
20
by: spamguy | last post by:
Assume an SqlCommand object with a valid connexion and SQL command of: UPDATE Company SET Web = @website WHERE ID = @companyID There exists a button on a form page that acts as a 'Submit':...
8
by: vaib | last post by:
hi all , It really seems that C never ceases to amaze . All this time i've been doing C and i thought i was quite adept at it but i was wrong . So without wasting any more time , here's the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
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,...

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.