START_DATE and END_DATE

jainson

New Member
Joined
Jun 30, 2011
Messages
15
Hi,

Are those two some kind of key words or so in access VBA? I am trying to run a form and it has a line
StartDate = Form_Daily_BSReport.START_DATE
EndDate = Form_Daily_BS_Report.END_DATE

I was wondering if someone could let me know that.

Thanks
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Hi,

Thanks for the responses.

So I have a huge table with records saved like in stacks. I was trying to create a filter in a form for dates, like a drop down menu from where user can select one or more than one date for which he wants the records, using a query or so. The query is quite simple using transform, select, from, where, group by and pivot by date so entered by the user.

But I am not able to create the filter. Any ideas on how to do that? I am trying to achieve this using a VBA Macro.

Thanks!
 
Upvote 0
You can use a listbox which can have all of the applicable dates by using a query from the table as its row source (have it use something like

Select Distinct DateFieldNamehere FROM tableNameHere ORDER BY DateFieldNameHere

and then you would need to set the listbox's Multi-Select property to either Simple or Extended and then you would iterate through to get the list to filter by:

Code:
Dim strWhere As String
Dim varItem As Variant
 
If Me.ListBoxNameHere.ItemsSelected.Count > 0 Then
 
   For Each varItem In Me.ListBoxNameHere.ItemsSelected
         strWhere = strWhere & "#" & Me.ListBoxNameHere.ItemData(varItem) & "#,"
   Next
 
   strWhere = "[DateFieldNameInTheFormsRecordset] In(" & Left(strWhere, Len(strWhere) - 1) & ")"
 
   Me.Filter = strWhere
   Me.FilterOn = True
 
Else
   Msgbox "No dates have been selected.", vbInformation, "Selection Error"
End If
 
Upvote 0

Forum statistics

Threads
1,224,548
Messages
6,179,445
Members
452,915
Latest member
hannnahheileen

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top