sql

  • Thread starter Thread starter Wahab
  • Start date Start date
W

Wahab

Hi everybody,
I've created a form with 2 fields BeginningDate and
EndingDate, with short date format. I want to write sql to
select the records from table which are between those 2
fields. Please note that, I don't want to make a query , I
want to open recordset for selected records.
Please give me an exact sql.
Thanks in advance.
 
Why don't you like queries? They are very useful....

You didn't give enough info so this is how you can generate your own SQL:

1) Create a query, add the table and drag the fields you want to see in
the records.

2) In the column that you want to search on, add this to the criteria
row: (change formname to the name of the form that the above controls
are on)

Between Forms!formName!BeginningDate and Forms!formName!EndingDate


3) Change from Design View to SQL view

4) Copy the SQL Select statement

5) Paste it in the code module.

6) Add a few quotes and a couple ampersands and TaDa!! Instant SQL -
from a Query!!!



Steve
 
-----Original Message-----
Why don't you like queries? They are very useful....

You didn't give enough info so this is how you can generate your own SQL:

1) Create a query, add the table and drag the fields you want to see in
the records.

2) In the column that you want to search on, add this to the criteria
row: (change formname to the name of the form that the above controls
are on)

Between Forms!formName!BeginningDate and Forms!formName! EndingDate


3) Change from Design View to SQL view

4) Copy the SQL Select statement

5) Paste it in the code module.

6) Add a few quotes and a couple ampersands and TaDa!! Instant SQL -
from a Query!!!



Steve
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


.
Thanks for your reply, but this exactly I don't want. Let
me make it more short, I want to write a recordset to
select Invoices form table tInvoices where dates are
between 2 dates which is Beginning and Ending Date, there
how i will write the same.
"SELECT * FROM tInvoices WHERE InvoiceNo Between Forms!
[SalesDialogBox]!BeginningDate and Forms![SalesDialogBox]!
EndingDate"
Please correct the above string.
Thanks
 
"SELECT * FROM tInvoices WHERE InvoiceNo Between Forms!
[SalesDialogBox]!BeginningDate and Forms![SalesDialogBox]!
EndingDate"
Please correct the above string.
Thanks


'this should be on one line
"SELECT * FROM tInvoices WHERE InvoiceNo Between #"
&Forms![SalesDialogBox]!BeginningDate & "# and #" &
Forms![SalesDialogBox]!EndingDate & "#;"
 
-----Original Message-----
Hi everybody,
I've created a form with 2 fields BeginningDate and
EndingDate, with short date format. I want to write sql to
select the records from table which are between those 2
fields. Please note that, I don't want to make a query , I
want to open recordset for selected records.
Please give me an exact sql.
Thanks in advance.
.
Hi Stive
Thank you very much it solved my problem, by the way can
you lookin crosstab query report I created? I will be very
much tankful to you.
Wahab
 
Thank you very much it solved my problem, by the way can
you lookin crosstab query report I created? I will be very
much tankful to you.
Wahab
You're welcome.

It would be best to start a new thread. To save time, be sure to post
the SQL from the query.

I'm not much on crosstab queries, but I'll look at it. There are more
knowledgeable people on the forum.
 
Back
Top