I am using Access 2007. I have a form with two Combo Boxes and a Text box. the first combo box CboZone have values like zone1, zone2,.. the 2nd Combo box CboMonth has values like Month1, Month2.. I need to populate the text box with a value from a table Small_6M depending on the values selected in the combo boxes. the controls are text and the value collected is a number. the MsgBox does return anything. i do not know why.
I really need to get this working asap i have been trying for while with no luck.thanks
Here is the Code:
** Mod Edit **
The layout of the data in [Small_6M] varies from month to month, but follows the following general layout :
Table = [Small_6M]
There are twelve monthly columns starting with the month following the current one. [mmm_yyyy] for January of 2012, for instance, would be [Jan_2012] and the last field would be [Dec_2012].
An example of some of the data might be :
I really need to get this working asap i have been trying for while with no luck.thanks
Here is the Code:
Code:
Private Sub CboMonth_AfterUpdate()
Dim strSql As String
MsgBox "[" & Me.CboMonth & "]"
strSql = "Select Small_6M.Dec_2011 From Small_6M Where Small_6M.Zone = '" & Me!CboZone & "'"
Me.txt1 = "'" & strSql & "'"
End Sub
The layout of the data in [Small_6M] varies from month to month, but follows the following general layout :
Table = [Small_6M]
Code:
[U][B]Field Name Type[/B][/U] Zone String mmm_yyyy Numeric Double ... mmm_yyyy Numeric Double
An example of some of the data might be :
Code:
[B][U]Zone Jan_2012 F3 Feb_2012 F5 Mar_2012 F7 F8 Apr_2012[/U] ...[/B] AEP South 0.05309 0.05832 0.06381 0.06494 ... AEP West 0.04528 0.052 0.05918 0.06177 ... CenterPoint 0.05433 0.0594 0.06465 0.06585 ... Oncor 0.05258 0.05772 0.06311 0.06467 ... TNMP 0.05258 0.05772 0.06311 0.06467 ...
Comment