Tomorrow's my final presentation of my DB and I ran into an unexpected problem: I access a main form called frmViewAllResou rces with several tabbed subforms through my switchboard. There's a preview and print button on the main form that generates a report called "Commoditie s." It previews and prints all the relevant fields from the main form and subform just fine.
On my switchboard, I can also access a form to print reports using a date range. My sample report "Commoditie s," which was auto-wizarded on tblResources (frmViewAllReso urces) worked just fine an hour ago. Then, I opened the report and started adding textboxes and comboboxes that linked to other forms (i.e. the subforms in frmViewAllResou rces). After flipping back to form view, all the boxes displayed the correct information for all 4 dummy records.
However, once I opened up the form to print reports by date range and selected "Commoditie s," the report opened up with "#Name?" in all fields. This is the code I'm using for my date range form: - Private Sub cmdPrintPreview_Click()
-
-
Dim strField As String 'Name of your date field.
-
Dim strWhere As String 'Where condition for OpenReport.
-
Const conDateFormat = "\#mm\/dd\/yyyy\#"
-
-
strField = "RecordDate"
-
-
If Not IsNull(cmbReports) And cmbReports <> "<select>" Then
-
If IsNull(Me.txtStartDate) Then
-
If Not IsNull(Me.txtEndDate) Then 'End date, but no start.
-
strWhere = strField & " <= " & Format(Me.txtEndDate, conDateFormat)
-
End If
-
Else
-
If IsNull(Me.txtEndDate) Then 'Start date, but no End.
-
strWhere = strField & " >= " & Format(Me.txtStartDate, conDateFormat)
-
Else 'Both start and end dates.
-
strWhere = strField & " Between " & Format(Me.txtStartDate, conDateFormat) _
-
& " And " & Format(Me.txtEndDate, conDateFormat)
-
End If
-
End If
-
Else
-
MsgBox ("You Must First Select a Report To Preview!")
-
cmbReports.SetFocus
-
End If
-
-
' Debug.Print strWhere 'For debugging purposes only.
-
DoCmd.OpenReport cmbReports, acViewPreview, , strWhere
-
End Sub
Would anything here having anything to do with my form's phenomenon? Or, should I instead have my report's fields refer to the tables instead of the forms? Linking to the tables makes much more sense, so I'm going to try that. I apologize for not trying it before posting, but my time is limited so I'll need some ready advice if it doesn't work. Thanks.
Dec 10 '07
11 1767
Oh, would it help if I used and based the report on a query instead? I'm guessing this way I can combine all the records I need.
UPDATE:
It appears to have worked. Now I don't need all the long references like below:
e.g. -
=Forms!frmViewAllResources!sfrmAdminTab.Form!Requestedby
-
JustJim 407
Recognized Expert Contributor
Oh, would it help if I used and based the report on a query instead? I'm guessing this way I can combine all the records I need.
UPDATE:
It appears to have worked. Now I don't need all the long references like below:
e.g. -
=Forms!frmViewAllResources!sfrmAdminTab.Form!Requestedby
-
Yes, my next suggestion was to take a deep breath and a short step back. Lets limit the number of places your report has to look to get it's data from.
Ideally this would be one source (1 table or 1 query or 1 form etc). Let's make it 1 query but use a preceding step to use 1 form to gather any operator input into parameters of that query. Sounds good in theory, doesn't it?
Jim
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: U N Me |
last post by:
I have a continuous form that lists records from a query. One of the
columns is an amount field, In the footer of the form I place a text
box that displays the total (sum) of the amount.
The data in the form is linked from a one-to-many table relationship.
In this instance, I really can't sum the value from the one's table
since if there were 3 records in the many table for a record id, the
value would be summed 3 times. IOW, I may be...
|
by: CSDunn |
last post by:
Hello,
I have a situation with MS Access 2000 in which I need to display report
data in spreadsheet orientation (much like a datasheet view for a form). If
you think of the report in terms of what a spreadsheet might show, the
column names will actually be dynamic, based on data from a SQL Server 2000
database. The row data will also come from the same database. So in this
case, I will have a main report and a subreport. I've already tried...
|
by: LoopyNZ |
last post by:
Hi,
(Access 97)
I'm creating a query (QRY_SUMMARY) to join a query (QRY) to itself
(QRY_1). I'm returning QRY.* and selected fields from QRY_1. With each
field (field_name) I return from QRY_1 I'm appending "_1" to to the end
to avoid name conflicts with the fields from QRY, i.e. "field_name"
becomes "field_name_1".
|
by: PeteCresswell |
last post by:
I've been to
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/mschrt/html/vbobjtitleobject.asp,
but still don't have a clue.
For example, I've got a chart object namde 'grphStats' in a form named
frmChart.
?Forms!frmChart!grphStats.Name returns "grphStats" as expected, but
I can't get any further.
|
by: kkrizl |
last post by:
I have a form that displays general information about an alarm permit
location. There's a subform that shows detailed information about
burglar alarms that have gone off at the location. When a new alarm is
entered on the subform, I want to print a report that shows the general
information and the alarms that were entered.
The record source for the form is the Mailing List table (key is Alarm
#).
The record source for the subform is the...
| |
by: Daron |
last post by:
Is it possible to use a parameter as the field name, not just a
criteria?
Snippet of my SQL:
SELECT Eval("!!.(0)") AS
TestField, AS from qry_main
The parameter will hold the name of the field. In the first
column, I want to show the name of the field for all records. In the
|
by: Orchid |
last post by:
Hello all,
I have different version of reports which used for different months.
For example, I am using report version 1 up to September, but we have
some design changes on the report for October, so I created report
version 2. I want a same Command Button to open the appropriated
version report for the specific month.
I create a table with the following Fields: Month, ReportID,
ReportToOpen (this is the exact report name). On a form,...
|
by: Chris White |
last post by:
Here's my XML
<?xml version="1.0" encoding="UTF-8"?>
<results>
<status code="ok"/>
<report-bulk-users>
<row principal-id="23859115" type="user">
<login>muser@domain.com</login>
<name>My User</name>
<email>myuser@domain.com</email>
<manager>manager@domain.com</manager>
|
by: srusskinyon |
last post by:
I need some help getting unique records from our database! I work for
a small non-profit homeless shelter. We keep track of guest
information as well as what services we have offered for statistical
purposes.
I've been using
Here's the situation:
I have two main tables:
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |