473,473 Members | 1,425 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Combobox to filter table using a date

2 New Member
I have created a form with a combo box to filter a subform using a date.

The filter works great but not with dates starting with a 0 e.g 01/07/2006

I have set the format to short date for the combo box, the table that feeds the combo box and the subform to be filtered.

I have also set the format in the code see below.

Private Sub Week_Ending_AfterUpdate()

[Form_Record Activity].Data_Subform.Form.FilterOn = False

If Week_Ending = 0 Then Exit Sub

Date_On_Box$ = Format$([Form_Record Activity].Week_Ending, "dd/mm/yyyy")



[Form_Record Activity].Data_Subform.Form.Filter = "[Week Ending Date] = #" & Date_On_Box$ & "#"


[Form_Record Activity].Data_Subform.Form.FilterOn = True

End Sub

I would be very grateful if anyone can help please.
Jul 29 '06 #1
2 6064
alzowze
3 New Member
Hi The_Monkey

Try applying the same format to both fields in the filter criteria.

[Form_Record Activity].Data_Subform.Form.Filter = "Format([Week Ending Date].'dd-mmm-yyyy') = #" & Format(Date_On_Box$,'dd-mmm-yyyy') & "#"


Alan ";0)
Jul 31 '06 #2
The_Monkey
2 New Member
Many thanks for your help.

I did try that but did not work for some reason. I have been struggling with this for a week and then I tried the following code and it worked perfect.

'Turn Filter off
[Form_Record Activity].Rec_Act_Subform.Form.FilterOn = False
'Assign Combo box value to variable
Date = [Form_Record Activity].Week_Ending
'Set Form Filter to value of Combo Box variable
[Form_Record Activity].Rec_Act_Subform.Form.Filter = "((Rec_Act_Subform.[Week Ending] =" & "'" & Date & "'" & "))"
'Leave Filter on
[Form_Record Activity].Rec_Act_Subform.Form.FilterOn = True

Many thanks again for responding to my question

The Monkey :D
Aug 1 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Susan Bricker | last post by:
The following error: "The current field must match the join key '?' in the table that seves as t the 'one' side of one-to-many relationship. Enter a record in the 'one' side table with the...
2
by: Susan Bricker | last post by:
I went back to read my post and found an error in my description ... here is the post, again, corrected: The following error: "The current field must match the join key '?' in the table that...
6
by: Doug Bell | last post by:
Hi I have a datagrid with a combo box, I need to populate the combo with data dependant on the record value. eg for record 1, field Warehouse = 2R so combo would allow selection of locations...
4
by: jon f kaminsky | last post by:
Hi- I've seen this problem discussed a jillion times but I cannot seem to implement any advice that makes it work. I am porting a large project from VB6 to .NET. The issue is using the combo box...
5
by: Rich | last post by:
Hello, I have a search application to search data in tables in a database (3 sql server tables). I populate 2 comboboxes with with data from each table. One combobox will contain unique...
2
by: jcf378 | last post by:
hi all. I have a form which contains a calculated control ("days") that outputs the # of days between two dates (DateDiff command between the fields and ). However, when I click "Filter by...
9
by: dee | last post by:
I'd like to filter by the following criteria: left(LeadDisposition,3) = "Sit" AND Appt_Date = Text767 I have no idea how to do this. Appreciate help.
1
by: The.Daryl.Lu | last post by:
Hi, two parts to my problem if someone can help address either one or both: 1. I want to SELECT everything in the table if it matches the criteria when the query button is pressed (this is just...
6
by: MyWaterloo | last post by:
''''''''''''''''''''''''''''''''''''''''''' ' The AfterUpdate event procedure used in ' ' the Find Customer combo box search. ' ''''''''''''''''''''''''''''''''''''''''''' 'Moves to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.