Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calendar Control Pop-UP date in 1899 1

Status
Not open for further replies.

jmob

Programmer
Jun 21, 2005
58
US
I have a Calendar Control (10.0 2002) that is on a pop up form. Once the user closes the pop-up form, the date on the parent form is set to what the user selected. I am getting a date of 12/30/1899 and a time around 12:00am though! I have run into a problem like this before, but I can't remember how to fix it. Thanks!
 
how are ya jmob . . .

How are you closing the form?

Where does the code reside that updates the date field?

Calvin.gif
See Ya! . . . . . .
 
This is the code in the calendar form that sets the parent form date to what was selected.

'The first two lines link to update the corresponding record.
Dim id As String 'this is a link value
id = Me.OpenArgs

'HERE IS THE CODE
sqlCmd = "Update [Table A] Set [TableA].[dtPlannedMeetingDate] = " & Me.Calendar0.value & " WHERE [TableA].[id] = " & id

DoCmd.RunSQL sqlCmd


I am getting only a time around 12:00am for my date field in the form.? The Me.calendar0.value seems to get the right date, but it doesn't put it correctly into the form field. The field is a date field. Is it possible the field wants a text field?
 
I don't know if it helps also, but my date field in my TableA is a Date/Time field (general date). I was getting an 1899 date before, now I am getting a time of 12:00:xx am for my date. I think it might be some kind of formatting error. But i'm lost. Thanks.
 
jmob said:
[blue]Once the user closes the pop-up form, the date on the parent form is set to what the user selected.[/blue]
So why are you updating the table instead of the [blue]Date Control[/blue] on the parent form (as you've stated)?

You should have:
Code:
[blue]Forms![purple][b]ParentFormName[/b][/purple]![purple][b]DateCtlName[/b][/purple] = Me![purple][b]CalendarCtlName.Value[/b][/purple][/blue]

Calvin.gif
See Ya! . . . . . .
 
Thanks. That solved it. I am relatively new to Access, and haven't used any references to the parent form. This will definately make some things easier for me!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top