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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems with drop down calanders on forms 1

Status
Not open for further replies.

Proteus7

IS-IT--Management
Feb 26, 2002
75
US
Hi,

I have this problem with a program I wrote. On the forms I have this OLE drop down calander on these forms that keeps kicking out an error unable to run file may be currupt.

Now when I wrote this program the pc's were running on 98 OS and now they have been upgraded to XP now the forms that have this calander will not run.

I tried to reinstall the same program on 98 OS and it worked. I have no clue. So I tried to use the ActiveX MS Date time picker, but I can't figure out how to get the date from this so that that date can be saved with that file. I tried:

ThisForm.Text1.value = This

just to get the info

Any ideas on how to fix the first one or how to get the date out from the Date and Time Picker or if you know of another way to get a different calander to work.

Thanks,

Larry
 
It would help if you would include certain information, such as the control that is actually throwing the error...is it the MS Monthview control or something else? When does the error occur, I mean what is the line of code that throws the error...is it on form load, when the calendar is instantiated, or some other time? Also, what is the exact error message? If it is a VFP error or an OLE Error then there should be a number and description given (though I gather that "unable to run file may be corrupt" is the description perhaps). These are just a few things that would most likely need to be divulged before an adequate solution to your problem could be found.

As for the MS Datetime picker, it can be data bound as it has a controlsource property OR you can get the the value of the control by putting the following in the olecontrol's change event for instance:

thisform.text1.value = this.object.value

...the value property is a little hidden in that you won't see it in the list of available properties for the olecontrol container that is wrapping the actual control. There are other properties that maybe of value to you such as Month, Day, and Year.

boyd.gif

 
Craig,

Thanks for the help. When the program starts and pulls up the main form and then it goes to procedure setcalander. On the below code line it throws out this error message.

CODE:

.OleCalendar.Object.Value = .txtDate.Value

MESSAGE:
OLE Exception error. Exception code c0000005. OLE object may be corrupt.


This calander is a class control based on a container.

In reguards to the Date and Time Pick I was hopeing that I could just pull out the date and not the time. I tried to use the Calander Control 8.0 using the code you gave me. But all I get is the same Message as my other calander.

Thanks,
Larry
 
As far as pulling the date and not the time...use the year, month, day properties of the datetime picker and send them as parameters to the VFP DATE() function...it will give you the date just like you want.

thisform.text1.value = Date(this.year, this.month, this.day)

As for the dreaded C-5 error...try unregistering and re-registering the ocx that your calendar control is based on...such as if it was the MonthView control then it would be MSCOMCT2.ocx I believe. It maybe this that is causing your problem, something in the registry corrupt.

If that doesn't fix the problem, then check all the system files on this box. Windows provides a pretty straight forward way to do this...from the run dialogbox or the command prompt type the following minus the quotes "sfc.exe /scannow" Let it run it's course and it will let you know if any of the system files are corrupt or the wrong version.

Post back with whether any of this resolved the problem...if not then we will have to dig a little further in order to figure out what is going on here. Also, I still don't see what version of VFP you're running. Try to include as much information as possible (within a certain amount of reason of course) when looking for a solution to a problem like this. I realize it is hard to guess what might be pertinent and what might not be, but usually the version of VFP is a pretty important piece of information, especially in this case since you are running into a C-5 error.

boyd.gif

 
Craig,

Thanks for the help. That new code worked. I was trying the Date() but I did not think of using (this.year, this.month, this.day) along with Date. This works just fine.

You maybe correct about the registery problem. I asked around and found out that when FoxPro was installed on this new OS on my work station that they kept having some failure error comming up and that maybe its all tied into each other.
The version is 6.0. With this new code and information you have given me. I think that I should be able to get the system up and running again soon. And be able to solve this registery problem.


Thanks,
Larry
 
Craig,

I was wondering if you might have one more insight for me.
I'm pluging in all the new calanders and changing the code.
However I have run into a snag. In some instances (using the Date & Time picker) I need to insert a particular date into the box.

When its comming from a table I can use the control source function in the properties window.
But at other times I need to run a SQL select to find a particular record and insert its date into that Date & Time picker.
Other times I just need to insert todays date into that box(or should I say that I need to be able to reset today's date after they use it and make a save)

I tried to use
ThisForm.Cntdate1.Date(this.year, this.month, this.day) = Date()
and even
ThisForm.Cntdate1.value = Date()
or
ThisForm.Cntdate1.refresh

But it wont work

Any ideas

Thanks,
Larry
 
You'll need to set the Day, Month, Year properties...and as I recall there was a particular order in which they needed to be done to avoid certain issues, but for the life of me I can't recall what that order is. Sorry.

boyd.gif

 
Thanks Craig for all your help.

I'm going to post another message out there for this problem. If I can get this figured out then the whole program will be up and running again.

If it can't be done then I need to find some other calander to use. Right now I cann't seem to think or find any other to use.

Thanks again,

Larry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top