Thank you both guys very much.
And sorry for not providing all the informations. My system on job is in Italian and it takes me a lot of time to decipher everything.
I've expected that somebody will point me other way, as I felt that my idea is not the most efficient one. I've post it just to not give false impressions that I haven't tried anything.
Also these SQL strings in VBA make me want to pull my hair off (which I don't have a lot btw). :)
Over the weekend I was struggling for almost 2 hours to get this line of code correctly:
Checks if data exist in the table based on the value of 3 textboxes from the form - If DCount("*", "[DATA_T]", _
-
"(([bank]='" & Form_frmMain.cmbBank & "') AND (" & "[division]='" & Form_frmMain.cmbDivision & "') AND (" & "[ref_date]='" & Converted_Period1 & "'))") > 0 Then
-
DataExist1_Period1 = True
-
End If
Anyway, I finished the tool yesterday and it has all the functionalities it needs to have.
But I wanted to add one more thing - this limitation on combo boxes, and when I started dealing again with SQL strings and error messages on Italian started to pop out, one after another - my head was about to explode.
----------
Anyway, NeoPA your solution worked. It was exactly what I wanted.
The thing is that I wasn't sure if it's possible to refer to the controls directly with the SQL. Somebody told me it needs to be done via functions. Blah...
So, just to repeat, here is the solution.
Periods are saved as text, not as date.
To be put directly into the "Row Source" for each cmbPeriod combobox. Combobox for which you're setting the Row Source should not be included. cmbPeriod1 - Row Source property - SELECT [Ref_Date] FROM [tblRefDate]
-
WHERE [Ref_Date] Not In
-
([Forms]![frmMain].[cmbPeriod2],
-
[Forms]![frmMain].[cmbPeriod3],
-
[Forms]![frmMain].[cmbPeriod4],
-
[Forms]![frmMain].[cmbPeriod5])
Also, like NeoPA said, Requery on After Update procedure: - Public Sub cmbPeriod1_AfterUpdate()
-
Me.cmbPeriod2.Requery
-
Me.cmbPeriod3.Requery
-
Me.cmbPeriod4.Requery
-
Me.cmbPeriod5.Requery
-
End Sub