yes, you did answer all my specific questions. i should have asked you to
describe what is happening - or not happening - that is different than
what
you expect to happen, when you click the command button on the
switchboard
form.
but let's try a small tweak first. the date field in the Transport table
should not be named "Date". this is an Access Reserved word, and
shouldn't
be used to name anything that *you* name, in your database. recommend you
change the name of the field in the table, but bear in mind that you'll
also
have to change the name in all queries, forms, reports, macros and code
where the name appears. if this isn't a practical alternative for you,
then
at least surround the field name with brackets in your query, as
PARAMETERS [forms]![Switchboard]![SearchDate] DateTime;
SELECT Transport.IdTransport, Transport.[Date]
FROM Transport
WHERE (((Transport.[Date])=[forms]![Switchboard]![SearchDate]));
also, make sure that the date field in the table actually has a data type
of
Date/Time.
if the above suggestions don't solve your problem, then as i said above,
please "describe what is happening - or not happening - that is different
than what you expect to happen, when you click the command button on the
switchboard form".
hth
antonov said:
Hello Tina,
1. The switchboard is called "Switchboard"
2. The textbox is called "SearchDate"
3. Private Sub Command6_Click()
On Error GoTo Err_Command6_Click
Dim stDocName As String
stDocName = "SearchDateIN"
DoCmd.OpenQuery stDocName, acNormal, acEdit
Exit_Command6_Click:
Exit Sub
Err_Command6_Click:
MsgBox Err.Description
Resume Exit_Command6_Click
End Sub
4. PARAMETERS [forms]![Switchboard]![SearchDate] DateTime;
SELECT Transport.IdTransport, Transport.Date
FROM Transport
WHERE (((Transport.Date)=[forms]![Switchboard]![SearchDate]));
that's it I think, these should be the info you asked for
thank you very much for your help
yes, it is possible, and it should work fine as i described. you'll
need
to
give me more information than "it doesn't work" if you want me to help you
troubleshoot.
what's the name of the switchboard form?
what's the name of the textbox control on the form where you type your
date?
post the code that runs when you click the command button on the
switchboard.
post the SQL statement from the query (open the query in design view,
click
on View | SQL, and the SQL pane will open. copy the *entire* SQL statement
and paste it into your post).
hth
Hello Tina, thanks for your reply... but it doesn't work (this is because
I
am probably doing something wrong).
In my Switchboard I have this text field (called Date) in which I do
input
a
date. Next to Date I have created a command button that when pushed
should
run a query. The query should return any operation done the date I input
in
Date. If nothing has been done that day then a message box should appear
with "No operations this date".
I don't know if my request makes any sense... but.... is it possible
to
create something like this?
Thanks for your patience
in query design view, add criteria to the date field, as
Forms!FormName!ControlName
replace FormName with the correct name of the form, and ControlName
with
the
correct name of the control on the form, of course. on the menu
bar,
click
Query | Parameters. copy the (corrected) expression into the Parameter
column and select Date/Time in the Data Type column.
note that the form must be open when the query runs, or you'll get
an
input
box requesting the value.
hth
Hello everybody, I have this query based on a table in which I
have 2
fields. One of them is a medium date one. In a form I need to
input
the
date
and the query should return every operation (if any) which have taken
place
that day... how can I do it?
thanks for any help