Why can't I get the same date when adding a new record?

A

Alex Martinez

I am using Access 2002 and I have a problem using MS Calendar Control, I
have no other choice but to use this type of control, although I know
there are better calendar controls out there. My problem seem when I add a
new record using a simple command button (see below for coding) I cannot
get the same date in my calendar control (see below for code). I need to
select a different date and then I can go back to the date I orginially
wanted. For example when I add a new record I selected September 4th in
the calender control to poplulate a field named "completed" and when I
add a new record again I can't choose September 4th again the calendar
button does nothing. I would have to select a different date let's say
September 5th and the calendar button would be depressed and September 5th
will be selected. Only then I can select September 4th again. I don't
understand why? Earlier I made the same appeal for help in the newsgroup
and received a tip (see below), but that did not worked I couldn't select
any date. This is a prority for me I would appreciate any tips or help.
Thank you in advance.


Add command

On Error GoTo Err_cmdAdd_Click

DoCmd.GoToRecord , , acNewRec
cboInvoiceType.SetFocus
Exit_cmdAdd_Click:
Exit Sub

Err_cmdAdd_Click:
MsgBox Err.Description
Resume Exit_cmdAdd_Click


Calendar Control - On Click
Private Sub CalendarCompleted_Click()

textCompleted.SetFocus
textCompleted.Value = CalendarCompleted.Value
CalendarCompleted.Visible = False

End Sub


Newsgroup tip

Add the following code after this line:
textCompleted.Value = CalendarCompleted.Value

CalendarCompleted.Value = Null
 
W

Wayne Morgan

It appears to be a bug in the calendar control. The only way I see around it
is to set a Default Value for the calendar control's field in the table.
You'll need to set this in the table design itself, the calendar control
doesn't have a default value option.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top