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: - [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!
9 1840
Sorry folks, that was a fib. When I put the criteria in as - [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?
Haha, you asked for it! - 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
-
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
-
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
-
HAVING (((Max(tblAccounts.AcctHoldingBranch))=[Forms]![frmReportGenerator]![cboBranchName]))
-
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?
Ok.
Post please: - tblAccounts.AcctHoldingBranch field parameters (particularly datatype)
- [Forms]![frmReportGenerator]![cboBranchName] properties: RowSource, ColumnCount, BoundColumn
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: - 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...
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!
You are welcome.
Best regards,
Fish.
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.
NeoPa 32,556
Expert Mod 16PB Sign in to post your reply or Sign up for a free account.
Similar topics
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?
|
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...
|
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...
|
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...
|
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);...
|
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...
|
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....
|
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':...
|
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...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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,...
|
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...
|
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,...
| |