I have a table tbl_Cost. In my form I have a combo box (cmb_Year) and
a textbox (Text7). Now the control source of Text 7 is
=DLookUp("[COSTYear]","[tbl_COSTAPPEND]","[cmb_Year] =[COSTYear] ")
The rowsource of the cmb_Year is
SELECT tbl_YEAR.YEARID, tbl_YEAR.YEAR
FROM tbl_YEAR;
On the After update event of this combo box I have the following code;
Me.Refresh
If Me.cmb_Year = Me.Text7 Then
MsgBox ("Duplicate")
End If
Now if I select the year 2007 from cmb_Year then Text 7 will also
display 2007, but if i select 2008 from cmb_Year then Text 7 will be
empty. However the above code doesn't work as I want it to if the
above condition is true a message box doesn't appear, is there
something wrong with my code
Thanks
Muriukis - 20 Jun 2007 10:36 GMT
> I have a table tbl_Cost. In my form I have a combo box (cmb_Year) and
> a textbox (Text7). Now the control source of Text 7 is
[quoted text clipped - 22 lines]
>
> Try to use a macro
Asif - 20 Jun 2007 10:46 GMT
Tried that doesn't work I'm thinking could it be something to do with
the settings of the combo box i.e. if i change the bound to column
number to 1 then nothing is displayed but if i change it to 2 Text7
shows a value
Asif - 20 Jun 2007 11:43 GMT
I think I've solved the problem the field CostYear was set to a number
field once I changed it to a text field it worked, but what I can't
understand is why doesn't it the code work if the field setting for
CostYear was set to Number?