Douglas J. Steele said:
I just reread your post a little closer. Since the combo box is on the
same
form, when the form opens, nothing going to be selected in the combo box,
so
it makes sense that nothing's display.
For the AfterUpdate event of the combo box, try the following Event
Procedure:
Private Sub cboApptDate_AfterUpdate()
Me.Requery
End Sub
so that the form's recordsource gets updated every time you select
something
in the combo box.
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
Hello Doug,
cboApptDate contains date only.
format of date in cboApptDate is 'Short Date'
Inserting CDate generated an error code saying the expression was to
complex
to be evaluated.
The problem is definitely in the WHERE clause, if I remove it entirely
from the criteria of the query then all of the records show in the
form.
If I remove [Forms] from [Forms]![SnglApptDis]![cboApptDate] and am
forced
to manually enter the parameters for cboApptDate, then the appropriate
records
are displayed.
I feel like I'm really close to solving this with your help.
Thanks again
Paul
:
Does ApptDate contain date only, or date and time?
What's the format of the date in the combo box?
You could try changing your Where clause to:
WHERE
CDate(tblApptDis.ApptDate)=CDate([Forms]![SnglApptDis]![cboApptDate])
--
Doug Steele, Microsoft Access MVP
(no private e-mails, please)
Hello Doug,
I took your advice and put all records in a single table
[tblApptDis],
and added a column that contains a date field[apptdate].
I then built a query[qryApptDis], that is supposed to look at only
the
records whose [apptdate] = [cboApptDate] on the form. This query is
what I used for the form's [SnglApptDis] RecordSource.
The value of [cboApptDate] is set by a calendar control.
This is the SQL for the query:
SELECT tblApptDis.CustomerID, tblApptDis.Row,
tblApptDis.RepairOrder,
tblApptDis.Name, tblApptDis.PhoneNumber, tblApptDis.Model,
tblApptDis.JobDescription, tblApptDis.FlatRate, tblApptDis.Tech,
tblApptDis.Status, tblApptDis.ApptDate, tblApptDis.Notify
FROM tblApptDis
WHERE (((tblApptDis.ApptDate)=[Forms]![SnglApptDis]![cboApptDate]));
When I open the form I don't see any records, it's opening as if it
were a
data entry form. (it's not). When I add a record it does go to the
table
correctly.
I'm sure I'm missing something obvious, can you see it?
Thanks again,
Paul
:
No offense, but if you've got multiple tables all alike, with names
like
5/13/2008, your design is wrong.
For one thing, you're hiding data in the names of the table.
Put everything into a single table with an additional date field in
it.
(Don't name the field Date: that's a reserved word!)
If you cannot (or will not) correct your design, try
Me.Text42.Value = DSum("[FlatRate]" , Me.cboApptDate.Value)
I don't see the need for variable FRSum (unless you're using the
value
elsewhere in the routine). If you do need FRSum, don't declare it
as
String.
DSum returns a number, not a string.
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
Thanks Doug,
The combo box value is set by a calendar control, Value = Date.
The table names are in a date format, ie; 5/13/2008.
I'm unsure of how to write the code for the DSum function.
Can you help?
Paul
:
I'm not sure I follow how a combo box named cboApptDate would
related
to
a
domain name, but yes, you can use a variable or a reference to a
function
that returns a string in all of the domain aggregate functions.
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
Hello, is it possible to set the domain argument of a DSum
expression
programmatticaly?
For example:
Dim FRSum As String
FRSum = DSum("[FlatRate]" , "(cboApptDate.Value) = domain
name")
Me.Text42.Value = FRSum
Or something like that, I haven't been able to find an example
and haven't been able to get anything to work.
Thanks in advance for any help.
Paul