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

ACCESS 2007 passing parameters to report not working

I have a report that runs a bunch of code to populate variables and then those variables are used as the control source in my report fields.

for example
var1 gets # of records in a table

I have a field on my report called myfield1 and the control soure is =[var1]

This has always worked in other versions of MS Access but now it throws #Name or #Error in some cases on the report.

I've stepped through the code and the variables are getting the right data on the code side but are not populating on the report side.

I check the references and they are the same on the Access 2002 (Sp2) db as they are on the new Access 2007 db I'm trying to work with but it runs fine on the 2002 one and not on 2007. The references I have checked are:
Visual Basic for Applications
Microsoft Access 12.0 Object Library
Microsoft DAO 3.6 Object Library
OLE Automation
Microsoft Visual Basic for Applictions Extensibility 5.3

Anyone have any ideas why this suddenly won't work?
Nov 20 '07 #1
4 3932
ADezii
8,834 Expert 8TB
I have a report that runs a bunch of code to populate variables and then those variables are used as the control source in my report fields.

for example
var1 gets # of records in a table

I have a field on my report called myfield1 and the control soure is =[var1]

This has always worked in other versions of MS Access but now it throws #Name or #Error in some cases on the report.

I've stepped through the code and the variables are getting the right data on the code side but are not populating on the report side.

I check the references and they are the same on the Access 2002 (Sp2) db as they are on the new Access 2007 db I'm trying to work with but it runs fine on the 2002 one and not on 2007. The references I have checked are:
Visual Basic for Applications
Microsoft Access 12.0 Object Library
Microsoft DAO 3.6 Object Library
OLE Automation
Microsoft Visual Basic for Applictions Extensibility 5.3

Anyone have any ideas why this suddenly won't work?
The Control Source can be a Field Name bound to a Field in a Table, Query, SQL Statement or data generated by an Expression. I was unaware that the Control Source of a Field can be set to a Variable, even if it is part of an Expression. Access will automatically surround any Variable which is part of a Control Source with brackets ([ ]) which normally indicate that the value within the brackets is either a Text Prompt or a Field Name. Please elaborate more on the details.
Nov 20 '07 #2
this is a technique I have used for years - it has always worked for me so it is not something that is new. You just use a variable and pass that variable the same way you would a control source or field.
Nov 20 '07 #3
ADezii
8,834 Expert 8TB
this is a technique I have used for years - it has always worked for me so it is not something that is new. You just use a variable and pass that variable the same way you would a control source or field.
syversda, are you 'Passing' the Variable or explicitly assigning the Variable to the Control Source of a Field? I must admit that I'm a little confused.
Nov 20 '07 #4
setting the control source = [variablename]
Nov 20 '07 #5

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

Similar topics

1
by: Maria | last post by:
Hello! I am new to Crystal reports an I have problems passing parameters form outside to Crystal report an creating a report with data from more than one table This is the problem: I have to...
5
by: lgeastwood | last post by:
I have a weird problem in Access 2007. I've been working in A07 for about 2 weeks when this thing began occurring. I'm working in the VB Code Editor and set break points for event procedures....
4
by: lupo666 | last post by:
Hi everybody, this time I have three problems driving me nuts :-((( (1) I have a report with 20 or so Yes/No "squares". Is there a way to either hide/show the "square" or change the yes/no...
2
by: EORTIZ | last post by:
I have a report that is grouped by a field. I have looked for ways in which it would be possible to obtain an individual report for each group to export to PDF. Since if I have all groups in the...
9
by: prakashwadhwani | last post by:
Hi !! I'm about to develop a new project for a client. Should I go about it in Access 2003 or 2007 ? Purchasing it either for me or for my client is not a major consideration here ... what I'd...
3
by: Brett Barry: Go Get Geek! | last post by:
Hello, I just started using Access 2007 after using Access 2003 for a long time. I've created all my queries and they work fine. However, either I forgot or it has changed but, how do I create a...
3
by: Rhys Gottwald | last post by:
Hi All, I have a report that is going to have 30 odd fields each containing a number, the number is the wind speed. I want to format the background of the field based on the value of the...
1
by: Pankaj K Joshi | last post by:
I have prepared ledger in Access 2007, in the report I have given running total so that i can get closing balance. Its working fine, but when i give period range to report the closing balnce gets...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.