run - time error 2450 (1 Viewer)

pen

New member
Local time
Today, 23:05
Joined
Oct 3, 2001
Messages
6
Hi, I developed this code to prompt calendar.
When I use onclick event for a control in a form this coding works fine. But if I changed the form to datasheet and its name remains the same, when I run the code, it says it doesn't recognized the form name even though it is the same name except for I changed the form to datasheet.

Microsoft access can't find the form
DeptInvolveda refered to in a macro expression or visual basic code.

----
ElseIf tarikh = 5 Then
Forms!DeptInvolveda.AcDate = Text1.Value
Text1.Value = Format(Text1.Value, "dd-mmm-yyyy")
End If

Is there a workaround to solve this problem?
thanks
 

pen

New member
Local time
Today, 23:05
Joined
Oct 3, 2001
Messages
6
hi sorry..I accidently type the name wrongly..it is supposed to be
Forms!Complaint!DeptInvolved.Form!AcDate = Text1.Value
(the control is in a subform)...
if the same coding I used in a form, it works fine..BUT if the same coding I use in a datasheet it will gives error..
Run -time error '2465'
Microsoft Access can't find the field 'AcDate' referred to in your expression.

hope you can help..
thanks
 
R

Rich

Guest
What do you mean change the form to datasheet, do you mean the subform, are you opening the subform on its own? If you change the main form to datasheet then the subform will not be there. Also check the name of the control.
HTH
 

pen

New member
Local time
Today, 23:05
Joined
Oct 3, 2001
Messages
6
My main form is a form but my subform is a datasheet...and I have checked the control name..it is correct...I tried to open the datasheet(subform) through the main form and I tried to double click the control (in the datasheet subform)to open the calendar and it gives the error that I mentioned previously....
BUT if i use the subform as a subform and not datasheet, there will be no error at all..and the calendar control will appear ..

I set it to datasheet in the form properties -> format -> Default view is datasheet and views allowed is datasheet..

thanks
 

Users who are viewing this thread

Top Bottom