Combo Box Not working

kapil0712

Registered User.
Local time
Today, 08:13
Joined
Jun 2, 2008
Messages
11
Hello,
I have set up a combo box which shows up the values of training types.
If there is a training taken, then it has a specific date entered as well.
I would like to disable the combo box (Training Type) when there is a entry in the field Date Taken so that no one can change the training details. But when there is no data in the Date Taken field, I would like the combo box to be enabled so that I can edit the training type.

I tried the following code:
If DateTaken <> 0 Then
Form.SetFocus
CourseName.Enabled = True
Else
CourseName.Enabled =False

Forms![frmCurrentEmployeesKapil].DefaultEditing = 2

End If

Where my form name is CurrentEmployeesKapil.


Please let me know what should I do. I tried all sorts of combinations of codes but nothing seems to work. Also could you please tell me where to find the name of the combo box. I am sure I got the right name but it doesn't seem to work.


Thanks in advance
kapil
 
Something like the following in the forms onCurrent event:

Code:
If me.DateTaken & "" = "" Then
   me.CourseName.Enabled = True
Else
   me.CourseName.Enabled =False
end if

???
 
reply: Combo box

Thanks Ken,
I am sorry I am not very familiar with access. Could you please tell me where exactly to fit the code (Oncurrent event means?)
Also where to find the name of the combo box?

Thanks
 
Both of these are in the properties window for the form and combo box.
 
reply: Combo box

Thanks a lot again..but i am not able to find the the OnCurrent event..
I am able to find Onenter Onexit onclick and others..
What should I do? And the code is not working at the above mentioned places.
Thanks
 
attached is the form

Thanks Bob,
But I am still not getting the oncurrent event for the sub form. Attached alongwith is the example...
Could you please check whats the problem...I have the problem posted earlier.
Thanks a lot
 

Attachments

It's going to be kind of hard without any of the tables.
 
Re. attached is the form

Bob attached is the complete list of tables. I am sorry there is no data in the tables since its against the institution policy.
Hope that will get some idea..
thanks bob
 

Attachments

Okay - here's your revised sample.

A few things -

1. I put the employee ID text box on the main form just to verify that the subform had the right number

2. Your design is a bit out of sorts and I had to add a primary key to your tblTrainingDetails and modify a little around course to add a course ID. You really need some additional help in getting the right table design. Your relationships were a bit off too (I didn't really fix them, but you will want to).

If you have questions let me know. See attached to see it work (in the main/subform setup).
 

Attachments

Thanks..finally got it to work with right path (form!subform!eventname)

Bob,
I didn't consider the path...i mean form name then sub form name then the event name.
after considering it, it did work..:):):)
thanks a lot...
kapil
 

Users who are viewing this thread

Back
Top Bottom