Select the Month & Year?

G

Guest

I try to make a time period selection function. I use 4 combo boxes to make
the StartMonth, StartYear(Default 2005), EndMonth(Default Month(this month)),
and EndYear(Default Year(this year)). And I make a StartDate and EndDate to
store the value in the form. I make these 2 values visible to check the data.
When I run this form, it shows empty data. I need to select each combo box
(Month & Year), then it will update the value, otherwise, the value will show
#Error. Now my question is how to make it read the default data? so I just
need to change the value(For example, StartMonth) I want.

Thank you.

Fox
 
G

Guest

In the from, it show
Start Month "StartMonth Combobox" "StartYear Combobox"
End Month "EndMonth Combobox" "EndYear Combobox"

I made StartYear & EndYear default value 2006, EndMonth default
=Month(Now())+1, and StartMonth no default.

TextBox StartDate =[StartMonth]+"/01/"+[StartYear]
EndDate =[EndMonth]+"/01/"+[EndYear]

Before I change combo boxes, StartDate show blank, but EndDate show #Error
When I test it, if I press all four combo boxes, the textboxes show the
value I want. But if I only select StartMonth, the StartDate will show
#Error, too. But I want it change to value with those three default value
even I didn't change those three combo boxes. Is anyway to do it?

Thank you.

Fox
 
G

Guest

A ComboBox has multiple data to select from. It sound like you should be
using TextBoxes. What are you using these ComboBoxes for?

Are these used in criteria for a query?

To use a TextBox as criteria in a query you should have this for the
defaults --
StartYear - Format(Date(),"yyyy")
StartMonth - Format(Date(),"mm")
EndYear - Format(Date(),"yyyy")
EndMonth - Format(DateAdd("mm",1,Date()),"m")

StartDate =DateSerial([StartYear]&[StartMonth]&"01")
EndDate =DateSerial([EndYear]&[EndMonth]&"01")


fox said:
In the from, it show
Start Month "StartMonth Combobox" "StartYear Combobox"
End Month "EndMonth Combobox" "EndYear Combobox"

I made StartYear & EndYear default value 2006, EndMonth default
=Month(Now())+1, and StartMonth no default.

TextBox StartDate =[StartMonth]+"/01/"+[StartYear]
EndDate =[EndMonth]+"/01/"+[EndYear]

Before I change combo boxes, StartDate show blank, but EndDate show #Error
When I test it, if I press all four combo boxes, the textboxes show the
value I want. But if I only select StartMonth, the StartDate will show
#Error, too. But I want it change to value with those three default value
even I didn't change those three combo boxes. Is anyway to do it?

Thank you.

Fox


KARL DEWEY said:
What is your SQL statement in the query that is the source for the form?
 
G

Guest

So I can't use Combo box for this solutions? I use them for user to select
Month(1-12) and Year(2002-2008). Then use the data to filter the record.

KARL DEWEY said:
A ComboBox has multiple data to select from. It sound like you should be
using TextBoxes. What are you using these ComboBoxes for?

Are these used in criteria for a query?

To use a TextBox as criteria in a query you should have this for the
defaults --
StartYear - Format(Date(),"yyyy")
StartMonth - Format(Date(),"mm")
EndYear - Format(Date(),"yyyy")
EndMonth - Format(DateAdd("mm",1,Date()),"m")

StartDate =DateSerial([StartYear]&[StartMonth]&"01")
EndDate =DateSerial([EndYear]&[EndMonth]&"01")


fox said:
In the from, it show
Start Month "StartMonth Combobox" "StartYear Combobox"
End Month "EndMonth Combobox" "EndYear Combobox"

I made StartYear & EndYear default value 2006, EndMonth default
=Month(Now())+1, and StartMonth no default.

TextBox StartDate =[StartMonth]+"/01/"+[StartYear]
EndDate =[EndMonth]+"/01/"+[EndYear]

Before I change combo boxes, StartDate show blank, but EndDate show #Error
When I test it, if I press all four combo boxes, the textboxes show the
value I want. But if I only select StartMonth, the StartDate will show
#Error, too. But I want it change to value with those three default value
even I didn't change those three combo boxes. Is anyway to do it?

Thank you.

Fox


KARL DEWEY said:
What is your SQL statement in the query that is the source for the form?

:

I try to make a time period selection function. I use 4 combo boxes to make
the StartMonth, StartYear(Default 2005), EndMonth(Default Month(this month)),
and EndYear(Default Year(this year)). And I make a StartDate and EndDate to
store the value in the form. I make these 2 values visible to check the data.
When I run this form, it shows empty data. I need to select each combo box
(Month & Year), then it will update the value, otherwise, the value will show
#Error. Now my question is how to make it read the default data? so I just
need to change the value(For example, StartMonth) I want.

Thank you.

Fox
 
G

Guest

Yes you can use comboboxes or listboxes if you want.

fox said:
So I can't use Combo box for this solutions? I use them for user to select
Month(1-12) and Year(2002-2008). Then use the data to filter the record.

KARL DEWEY said:
A ComboBox has multiple data to select from. It sound like you should be
using TextBoxes. What are you using these ComboBoxes for?

Are these used in criteria for a query?

To use a TextBox as criteria in a query you should have this for the
defaults --
StartYear - Format(Date(),"yyyy")
StartMonth - Format(Date(),"mm")
EndYear - Format(Date(),"yyyy")
EndMonth - Format(DateAdd("mm",1,Date()),"m")

StartDate =DateSerial([StartYear]&[StartMonth]&"01")
EndDate =DateSerial([EndYear]&[EndMonth]&"01")


fox said:
In the from, it show
Start Month "StartMonth Combobox" "StartYear Combobox"
End Month "EndMonth Combobox" "EndYear Combobox"

I made StartYear & EndYear default value 2006, EndMonth default
=Month(Now())+1, and StartMonth no default.

TextBox StartDate =[StartMonth]+"/01/"+[StartYear]
EndDate =[EndMonth]+"/01/"+[EndYear]

Before I change combo boxes, StartDate show blank, but EndDate show #Error
When I test it, if I press all four combo boxes, the textboxes show the
value I want. But if I only select StartMonth, the StartDate will show
#Error, too. But I want it change to value with those three default value
even I didn't change those three combo boxes. Is anyway to do it?

Thank you.

Fox


:

What is your SQL statement in the query that is the source for the form?

:

I try to make a time period selection function. I use 4 combo boxes to make
the StartMonth, StartYear(Default 2005), EndMonth(Default Month(this month)),
and EndYear(Default Year(this year)). And I make a StartDate and EndDate to
store the value in the form. I make these 2 values visible to check the data.
When I run this form, it shows empty data. I need to select each combo box
(Month & Year), then it will update the value, otherwise, the value will show
#Error. Now my question is how to make it read the default data? so I just
need to change the value(For example, StartMonth) I want.

Thank you.

Fox
 
G

Guest

It seems like I have SQL code problem, too.
I use vba code
strSelect = "Select [RecordDate] " & _
"From [Record] " & _
"Where [Company] = '" & Me.SelectCompany.Value & "' And " & _
" [RecordDate] < #" & Me.EndDate.Value & "# And
[RecordDate] > #" & Me.StartDate.Value & "#" & _
"Order by [RecordDate] DESC"
I need it keeps the record data which between the date, but I think the
StartDate and EndDate code is wrong.

KARL DEWEY said:
Yes you can use comboboxes or listboxes if you want.

fox said:
So I can't use Combo box for this solutions? I use them for user to select
Month(1-12) and Year(2002-2008). Then use the data to filter the record.

KARL DEWEY said:
A ComboBox has multiple data to select from. It sound like you should be
using TextBoxes. What are you using these ComboBoxes for?

Are these used in criteria for a query?

To use a TextBox as criteria in a query you should have this for the
defaults --
StartYear - Format(Date(),"yyyy")
StartMonth - Format(Date(),"mm")
EndYear - Format(Date(),"yyyy")
EndMonth - Format(DateAdd("mm",1,Date()),"m")

StartDate =DateSerial([StartYear]&[StartMonth]&"01")
EndDate =DateSerial([EndYear]&[EndMonth]&"01")


:

In the from, it show
Start Month "StartMonth Combobox" "StartYear Combobox"
End Month "EndMonth Combobox" "EndYear Combobox"

I made StartYear & EndYear default value 2006, EndMonth default
=Month(Now())+1, and StartMonth no default.

TextBox StartDate =[StartMonth]+"/01/"+[StartYear]
EndDate =[EndMonth]+"/01/"+[EndYear]

Before I change combo boxes, StartDate show blank, but EndDate show #Error
When I test it, if I press all four combo boxes, the textboxes show the
value I want. But if I only select StartMonth, the StartDate will show
#Error, too. But I want it change to value with those three default value
even I didn't change those three combo boxes. Is anyway to do it?

Thank you.

Fox


:

What is your SQL statement in the query that is the source for the form?

:

I try to make a time period selection function. I use 4 combo boxes to make
the StartMonth, StartYear(Default 2005), EndMonth(Default Month(this month)),
and EndYear(Default Year(this year)). And I make a StartDate and EndDate to
store the value in the form. I make these 2 values visible to check the data.
When I run this form, it shows empty data. I need to select each combo box
(Month & Year), then it will update the value, otherwise, the value will show
#Error. Now my question is how to make it read the default data? so I just
need to change the value(For example, StartMonth) I want.

Thank you.

Fox
 
G

Guest

You will need someone else to work with you on code.

fox said:
It seems like I have SQL code problem, too.
I use vba code
strSelect = "Select [RecordDate] " & _
"From [Record] " & _
"Where [Company] = '" & Me.SelectCompany.Value & "' And " & _
" [RecordDate] < #" & Me.EndDate.Value & "# And
[RecordDate] > #" & Me.StartDate.Value & "#" & _
"Order by [RecordDate] DESC"
I need it keeps the record data which between the date, but I think the
StartDate and EndDate code is wrong.

KARL DEWEY said:
Yes you can use comboboxes or listboxes if you want.

fox said:
So I can't use Combo box for this solutions? I use them for user to select
Month(1-12) and Year(2002-2008). Then use the data to filter the record.

:

A ComboBox has multiple data to select from. It sound like you should be
using TextBoxes. What are you using these ComboBoxes for?

Are these used in criteria for a query?

To use a TextBox as criteria in a query you should have this for the
defaults --
StartYear - Format(Date(),"yyyy")
StartMonth - Format(Date(),"mm")
EndYear - Format(Date(),"yyyy")
EndMonth - Format(DateAdd("mm",1,Date()),"m")

StartDate =DateSerial([StartYear]&[StartMonth]&"01")
EndDate =DateSerial([EndYear]&[EndMonth]&"01")


:

In the from, it show
Start Month "StartMonth Combobox" "StartYear Combobox"
End Month "EndMonth Combobox" "EndYear Combobox"

I made StartYear & EndYear default value 2006, EndMonth default
=Month(Now())+1, and StartMonth no default.

TextBox StartDate =[StartMonth]+"/01/"+[StartYear]
EndDate =[EndMonth]+"/01/"+[EndYear]

Before I change combo boxes, StartDate show blank, but EndDate show #Error
When I test it, if I press all four combo boxes, the textboxes show the
value I want. But if I only select StartMonth, the StartDate will show
#Error, too. But I want it change to value with those three default value
even I didn't change those three combo boxes. Is anyway to do it?

Thank you.

Fox


:

What is your SQL statement in the query that is the source for the form?

:

I try to make a time period selection function. I use 4 combo boxes to make
the StartMonth, StartYear(Default 2005), EndMonth(Default Month(this month)),
and EndYear(Default Year(this year)). And I make a StartDate and EndDate to
store the value in the form. I make these 2 values visible to check the data.
When I run this form, it shows empty data. I need to select each combo box
(Month & Year), then it will update the value, otherwise, the value will show
#Error. Now my question is how to make it read the default data? so I just
need to change the value(For example, StartMonth) I want.

Thank you.

Fox
 

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

Top