Help with query

But as the forms source data is form the Data Query if the date is changed it would change the the forms data as long as the query is ran before the form is open
I didn't get you here.

back to the combo box I set rom source type to value list and use 1;2;3;4;5;6;7;8;9;10;11;12 and repeat for years 10;11;12 ect.
Why are you needing to repeat those two? You can still use January;February ... etc
 
Why are you needing to repeat those two? You can still use January;February ... etc
Not that, they are using one for years. But I would go with month numbers if possible as it makes it simpler for the DateSerial function.
 
I would like it to show the month names to be more clear
 
I would like it to show the month names to be more clear

Then to simplify, create a table for your months and use two fields:

MoNum
MoName

and then use

1 for the MoNum
January for the MoName

and then use a QUERY for your combo's rowsource instead of value list and then make it so that it is sorted by MoNum and that the combo's bound column is 1 and the column count is 2 and the column widths are 0";2"
 
See that I included one for 2000 and PRIOR (includes 97).

I get an error about could not find the microsoft jet database engine
 
I get an error about could not find the microsoft jet database engine
What exactly did you use and where did you put it?

The code I gave should not return an error regardless of version (I believe). It is very simple code.
 
I put it on the forms on load field

So you just copied this and pasted it in?
Code:
Dim strYear As String
Dim iYrItem As Integer
 
For iYrItem = Year(Now) - 3 To Year(Now) + 1
     strYear = strYear & CStr(iYrItem) & ";"
Next
strYear = Left(strYear, Len(strYear)-1)
 
Me.cboYear.RowSource = strYear
 
yes,

Private Sub Form_Load()
DoCmd.Maximize
Dim strYear As String
Dim iYrItem As Integer

For iYrItem = Year(Now) - 2 To Year(Now) + 2
strYear = strYear & CStr(iYrItem) & ";"
Next
strYear = Left(strYear, Len(strYear) - 1)

Me.cboYear.RowSource = strYear
End Sub
 
When the error message comes up does it give you a DEBUG button? If so, can you click it and tell us which line it highlights?
 
i just set the row source type to value list and it worked, think it was looking for a non existant table
 
both combo boxes now provide the drop down data although neither let me select any yet
 
Not that, they are using one for years. But I would go with month numbers if possible as it makes it simpler for the DateSerial function.
Alright, I follow. He can use a multi-column combo or maybe that will confuse matters. Get it working first :)
 
You didn't bind their control source to anything did you? They should both say UNBOUND when looking at them in the form's DESIGN view.
 
Check the Enabled and Locked properties of the combo. What values are they?

Also check the AllowEdits property of your FORM. What value is it?
 
Right is was Allow Edits on the form.

I now get a error of "The value you entered is not vaild for this field"

What format does the fields in the table need to be?
 
Which field? And what control are we talking about?
 

Users who are viewing this thread

Back
Top Bottom