Form and Requery

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form that is baed on a particular query that contains two different
sets of date criteria.

By default, the form opens with the beginning date this item was generated
generated and ends with today's date. But there's a search box on the form
so instead of getting 2 years worth of date, they can specify a narrower date
range.

This simply requerys the information based on the new beginning and new end
date.

OK so far. But this relaeds to the date the item was GENERATED. The form
also tracks the date the item was COMPLETED. How can I requery based on this
different set of date criteria. Can I requery based on a seperate query
(probably not?)

I would like to have my beginning and ending search box . . . . but inclide
a checkbox that would the the search to search by the COMPLETED Dates rather
than the GENERATED DATES

I know I'm not making good sense. But I have to start somewhere
 
Let me know if this is helpful:

If the box is checked, you use one query as the recordsource for the form,
if it's not, you use a different query. The first one pulls from the
Generated Start/End, the second from the Completed Start/End dates.

If Me.CheckBox Then

strSQL = "SELECT Table1.G_StartDate, Table1.G_EndDate,
Table1.C_StartDate, Table1.C_EndDate" & _
" FROM Table1" & _
" WHERE (((Table1.G_StartDate)=" &
[Forms]![frmData]![GeneratedStartDate] & ") AND ((Table1.G_EndDate)=" &
[Forms]![frmData]![GeneratedEndDate] & "));"

Else

strSQL = "SELECT Table1.G_StartDate, Table1.G_EndDate,
Table1.C_StartDate, Table1.C_EndDate" & _
" FROM Table1" & _
" WHERE (((Table1.C_StartDate)=" &
[Forms]![frmData]![CompletedStartDate] & ") AND ((Table1.C_EndDate)=" &
[Forms]![frmData]![CompletedEndDate] & "));"

End If

Me.RecordSource = strSQL
 
Thank you so much for the response. I have simply been overwhelmed with stuff
and have just now got back to this. I will get back to you in the next day or
so. I really appreciate your response.

Access101 said:
Let me know if this is helpful:

If the box is checked, you use one query as the recordsource for the form,
if it's not, you use a different query. The first one pulls from the
Generated Start/End, the second from the Completed Start/End dates.

If Me.CheckBox Then

strSQL = "SELECT Table1.G_StartDate, Table1.G_EndDate,
Table1.C_StartDate, Table1.C_EndDate" & _
" FROM Table1" & _
" WHERE (((Table1.G_StartDate)=" &
[Forms]![frmData]![GeneratedStartDate] & ") AND ((Table1.G_EndDate)=" &
[Forms]![frmData]![GeneratedEndDate] & "));"

Else

strSQL = "SELECT Table1.G_StartDate, Table1.G_EndDate,
Table1.C_StartDate, Table1.C_EndDate" & _
" FROM Table1" & _
" WHERE (((Table1.C_StartDate)=" &
[Forms]![frmData]![CompletedStartDate] & ") AND ((Table1.C_EndDate)=" &
[Forms]![frmData]![CompletedEndDate] & "));"

End If

Me.RecordSource = strSQL


G-Man said:
I have a form that is baed on a particular query that contains two different
sets of date criteria.

By default, the form opens with the beginning date this item was generated
generated and ends with today's date. But there's a search box on the form
so instead of getting 2 years worth of date, they can specify a narrower date
range.

This simply requerys the information based on the new beginning and new end
date.

OK so far. But this relaeds to the date the item was GENERATED. The form
also tracks the date the item was COMPLETED. How can I requery based on this
different set of date criteria. Can I requery based on a seperate query
(probably not?)

I would like to have my beginning and ending search box . . . . but inclide
a checkbox that would the the search to search by the COMPLETED Dates rather
than the GENERATED DATES

I know I'm not making good sense. But I have to start somewhere
 
Tahnks so much. Finally found time to look this over again, your post was
right on track. Helped me "span a knowledge gap" so to speak!

Access101 said:
Let me know if this is helpful:

If the box is checked, you use one query as the recordsource for the form,
if it's not, you use a different query. The first one pulls from the
Generated Start/End, the second from the Completed Start/End dates.

If Me.CheckBox Then

strSQL = "SELECT Table1.G_StartDate, Table1.G_EndDate,
Table1.C_StartDate, Table1.C_EndDate" & _
" FROM Table1" & _
" WHERE (((Table1.G_StartDate)=" &
[Forms]![frmData]![GeneratedStartDate] & ") AND ((Table1.G_EndDate)=" &
[Forms]![frmData]![GeneratedEndDate] & "));"

Else

strSQL = "SELECT Table1.G_StartDate, Table1.G_EndDate,
Table1.C_StartDate, Table1.C_EndDate" & _
" FROM Table1" & _
" WHERE (((Table1.C_StartDate)=" &
[Forms]![frmData]![CompletedStartDate] & ") AND ((Table1.C_EndDate)=" &
[Forms]![frmData]![CompletedEndDate] & "));"

End If

Me.RecordSource = strSQL


G-Man said:
I have a form that is baed on a particular query that contains two different
sets of date criteria.

By default, the form opens with the beginning date this item was generated
generated and ends with today's date. But there's a search box on the form
so instead of getting 2 years worth of date, they can specify a narrower date
range.

This simply requerys the information based on the new beginning and new end
date.

OK so far. But this relaeds to the date the item was GENERATED. The form
also tracks the date the item was COMPLETED. How can I requery based on this
different set of date criteria. Can I requery based on a seperate query
(probably not?)

I would like to have my beginning and ending search box . . . . but inclide
a checkbox that would the the search to search by the COMPLETED Dates rather
than the GENERATED DATES

I know I'm not making good sense. But I have to start somewhere
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

requery from form 13
Listbox on form 2
List Boxes Do Not Requery 5
requery hell 2
Combo Boxes & Requery Issues 2
Requery form 3
Requery Page in TabCtl 5
Requery a form that has a filter attached 1

Back
Top