Activating Calendar Control closes other form

brucle

Registered User.
Local time
Today, 16:20
Joined
Feb 17, 2003
Messages
27
Activating Calendar Control closes other form

I have been asked to fix a minor problem with an older database. When using calendar control on one form(PROJECTION_QUERY) to set the date, the main switchboard form(f_main) disappears!

f_main is called through an autoexec macro. It has a lot of update code behind it on load.

This is the code loaded when the calendar control opens

Private Sub Form_Load()
If IsNull([set_date]) Then
Me![cal_date] = DATE
Else
Me![cal_date] = set_date
End If
End Sub

and this is the code behind the text box on PROJECTION_QUERY

Private Sub DEMAND_FROM_DblClick(Cancel As Integer)
Set set_date = Me![DEMAND_FROM]
DoCmd.OpenForm "cal_date"
End Sub

Clear as mud, right?

Does anyone have any ideas what to do?
 
G’day brucle

I’ll assume that you copied and pasted the code directly from the editor.

The editor should not display the following line as is

Me![cal_date] = DATE

DATE should be Date. There is a strong possibility that the author of the database has used DATE as a field name in a table or as a Public variable or procedure. Doing so can cause all sorts of problems, some of which will seem very weird and unrelated, and can even lead to total corruption of the database.

The first thing to do is to make a copy of the database before it corrupts.

This next line should also be raising an error.

Set set_date = Me![DEMAND_FROM]

There are probably many other things wrong with this database but these two errors should be cleaned-up first.

Regards,
Chris.
 

Users who are viewing this thread

Back
Top Bottom