Greetings Gurus,
In a report showing the names of students and their progress, I am
getting an error in the name field (Name: #Error). The report gets its
data from an unbound form containing two unbound textboxes,
"txtStartDa te" and "txtEndDate ," and a multi-select listbox,
"listName." I think the error occurs when there is no correct
combination of data--for instance, no records for John Doe entered
during this past week.
This is my 1st attempt at making a form allowing a user to set multiple
criteria. I've tried to adapt code from Allen Browne's site and other
posts, but don't really know what I'm doing. I'd like for users to
select mutliple students (or ALL students) from the listbox and specify
a date range (which isn't required).
The report's name is rptProgressRepo rts.
The form's name is frmSelectReport .
The listbox's name is listname.
The listbox's row source is
SELECT Students.Studen tID, Students.LastNa me, Students.FirstN ame FROM
Students ORDER BY Students.LastNa me;
The command button's on click event is:
On Error GoTo Err_cmdOK_Click
Dim i As Integer
Dim stDocName As String
Dim stWhere As String
Dim sTest As String
Const conDateFormat = "\#mm\/dd\/yyyy\#"
stDocName = "rptProgressRep orts"
For i = 0 To listName.ItemsS elected.Count - 1
If stWhere <> "" Then stWhere = stWhere & ", "
stWhere = stWhere & listName.Column (0, listName.ItemsS elected(i))
Next
strDate = "Date" 'Date is the name of field in the detail section
of the report.
If IsNull(Me.txtSt artDate) Then
If Not IsNull(Me.txtEn dDate) Then 'End date, but no start.
sTest = strDate & " < " & Format(Me.txtEn dDate,
conDateFormat)
End If
Else
If IsNull(Me.txtEn dDate) Then 'Start date, but no End.
sTest = strDate & " > " & Format(Me.txtSt artDate,
conDateFormat)
Else 'Both start and end dates.
sTest = strDate & " Between " & Format(Me.txtSt artDate,
conDateFormat) _
& " And " & Format(Me.txtEn dDate, conDateFormat)
End If
End If
If stWhere <> "" Then
If sTest <> "" Then sTest = sTest & " AND "
sTest = sTest & "StudentID IN (" & stWhere & ")"
End If
DoCmd.OpenRepor t stDocName, acViewPreview, , sTest
Exit_cmdOK_Clic k:
Exit Sub
Err_cmdOK_Click :
MsgBox "Error " & Err.Number & ": " & Err.Description
Resume Exit_cmdOK_Clic k
End Sub
An example of the filter that was input into the Report's filter is:
(Date Between #01/23/2006# And #01/29/2006# AND StudentID IN (7))
The record source of the report is a query containing StudentID,
LastName, FirstName, ProgressID, Progress, Date, ClassID, and Class.
In terms of selecting ALL students from the listbox, is it possible to
do this with a union query involving multiple columns in the listbox?
Thanks,
Arnold 2 1801
Your first problem is that DATE is a reserved word in MSAccess.
(Date Between #01/23/2006# And #01/29/2006#
AND StudentID IN (7))
you also say 'Date is the name of field in the detail section of the report'
It's the name of the field in the query underlying the report
that you need to use. It's not clear that they are the same, if
not, adjust accordingly.
The answer to the question about adding "< ALL Sudents > to a
listbox is YES.
Q
"Arnold" <ee*******@kc.r r.com> wrote in
news:11******** *************@g 43g2000cwa.goog legroups.com:
Greetings Gurus,
In a report showing the names of students and their progress, I am getting an error in the name field (Name: #Error). The report gets its data from an unbound form containing two unbound textboxes, "txtStartDa te" and "txtEndDate ," and a multi-select listbox, "listName." I think the error occurs when there is no correct combination of data--for instance, no records for John Doe entered during this past week.
This is my 1st attempt at making a form allowing a user to set multiple criteria. I've tried to adapt code from Allen Browne's site and other posts, but don't really know what I'm doing. I'd like for users to select mutliple students (or ALL students) from the listbox and specify a date range (which isn't required).
The report's name is rptProgressRepo rts. The form's name is frmSelectReport . The listbox's name is listname. The listbox's row source is SELECT Students.Studen tID, Students.LastNa me, Students.FirstN ame FROM Students ORDER BY Students.LastNa me;
The command button's on click event is:
On Error GoTo Err_cmdOK_Click
Dim i As Integer Dim stDocName As String Dim stWhere As String Dim sTest As String Const conDateFormat = "\#mm\/dd\/yyyy\#"
stDocName = "rptProgressRep orts"
For i = 0 To listName.ItemsS elected.Count - 1 If stWhere <> "" Then stWhere = stWhere & ", " stWhere = stWhere & listName.Column (0, listName.ItemsS elected(i)) Next
strDate = "Date" 'Date is the name of field in the detail section of the report.
If IsNull(Me.txtSt artDate) Then If Not IsNull(Me.txtEn dDate) Then 'End date, but no start. sTest = strDate & " < " & Format(Me.txtEn dDate, conDateFormat) End If Else If IsNull(Me.txtEn dDate) Then 'Start date, but no End. sTest = strDate & " > " & Format(Me.txtSt artDate, conDateFormat) Else 'Both start and end dates. sTest = strDate & " Between " & Format(Me.txtSt artDate, conDateFormat) _ & " And " & Format(Me.txtEn dDate, conDateFormat) End If End If
If stWhere <> "" Then If sTest <> "" Then sTest = sTest & " AND " sTest = sTest & "StudentID IN (" & stWhere & ")" End If
DoCmd.OpenRepor t stDocName, acViewPreview, , sTest
Exit_cmdOK_Clic k: Exit Sub
Err_cmdOK_Click : MsgBox "Error " & Err.Number & ": " & Err.Description Resume Exit_cmdOK_Clic k End Sub
An example of the filter that was input into the Report's filter is: (Date Between #01/23/2006# And #01/29/2006# AND StudentID IN (7)) The record source of the report is a query containing StudentID, LastName, FirstName, ProgressID, Progress, Date, ClassID, and Class.
In terms of selecting ALL students from the listbox, is it possible to do this with a union query involving multiple columns in the listbox?
Thanks,
Arnold
--
Bob Quintal
PA is y I've altered my email address.
Thanks for the tip. I renamed the controls that were simply "date."
However, this didn't fix the problem where if a student is selected
from the listbox on the form, but no progress records were previously
entered for that student, the report generates but with an error for
the name's field.
Any other ideas?--all are greatly appreciated. Thanks. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Donna Sabol |
last post by:
First, I should start by saying I am creating a database to be used by
some very impatient, non-computer literate people. It needs to be
seameless in it's operation from their point of view. I want them to
do as little as possible when they run their reports.
I have a crosstab query that displays usage of items for each month.
It looks pretty much like this:
ITEM DESC UM 12/02 1/03 2/03 3/03 ...ETC.
1 Solution ...
|
by: Nathan Bloomfield |
last post by:
Does anyone know if there is any documentation which relates to Access2k + ?
or can anyone help adjust the code?
I am having trouble converting the DAO references.
TITLE :INF: How to Create a Dynamic Crosstab Report
PRODUCT :Microsoft Access
PROD/VER:1.00 1.10
OPER/SYS:WINDOWS
|
by: No Spam |
last post by:
Dear Access 2000 users,
I have a crosstab query that puts together certain information
perfectly. It has a criteria that is based on a form that limits how
many columns are returned based on the date selected. Here's the
problem:
The report that the crosstab query feeds was initially created to show
all the dates and thus, all 26 columns. However, since I modified the
crosstab query to only return up to what is selected on the...
|
by: manning_news |
last post by:
Using A2K. I've been asked to modify a report currently requiring only
one date parameter to now accept a date range. The main report has 2
subreports and is not bound to a table or query. The report prints
dental and hygenist appointments for the date (one subreport for each).
The user wants to enter a date range and have one page for each date
in the date range. I'm wondering how to modify the report. The only
way I see is to create...
|
by: prabhukalyan |
last post by:
Hi all,
I am not so good in queries. here is my problem
2 tables to store the received items (fabric)-- inwardmaster,
inwarddetails
and after some processing (Dyeing)
the items were deliverd and stored in tables -- deliverymaster,
deliverydetails
| |
by: sara |
last post by:
I have reports that run from a form where the user can choose a date
range, or they run automatically for a week in the "Weekly Reports"
option.
I created 2 queries and 2 reports - one query uses the WeekEndDate to
filter, and its associated report heading says "For the week Ending " &
forms!frmPrintReports.getWeekEndDate.
The other query selects the date range using "Between" and the 2 dates
on the form. Its associated report header...
|
by: Bill |
last post by:
I've searched comp.databases.ms-access for a solution and found help
but still haven't got my problem solved. I want to record weekly
attendance and print an attendance "check off" sheet where attendees
simply check on their name row and class date column to record their
attendance. The marked attendance sheet is later used to update the
database and print an updated attendance sheet for the following
week's class. I'm working with...
|
by: sara |
last post by:
Hi -
I have looked at all posts and tried both Allen Browne's Report
Sorting at run Time
( Select Case Forms!frmChooseSort!grpSort
Case 1 'Name
Me.GroupLevel(0).ControlSource = "LastName"
Me.GroupLevel(1).ControlSource = "FirstName") .....
And another post that was OrderByOn = True and setting the sort Order.
|
by: franc sutherland |
last post by:
Hello,
I have a report which I filter using the me.filter command in the
OnOpen event.
Me.Filter = "OrderID=" & Forms!variable_form_name!
Me.FilterOn = True
I want to be able to open that report, filtered, from different
forms. How do I carry the name of the current form into the
|
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: 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: 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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
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
|
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...
| |