Solved

Q_21884491.html - Still a problem

Posted on 2006-06-15
4
179 Views
Last Modified: 2013-12-18
Hi all,

In the link above is the code for the postdrag event of the calendar to help me drag and drop a calendar entry. Now with that i had a type mistmatch error. The error was fixed by implementing the following code inside the script in the link above.

      tmpList =doc.testdates
      i=0
      Forall x In tmpList
            Redim Preserve oldList(i)
            oldList(i) = Format$(x, "Short Date")
            i = i + 1
      End Forall

However, with this code now, the list that I am placing in the newList is a string list.
Now I want to try to convert it to date list(array of dates) instead of having newlist populated in my date field on the document as text list because I'll have a lot of other problems with it later.

I tried using the same loop above on the newlist, before assigning that to doc.testdates

              tmpList1 =doc.testdatefield
      j=0
      Forall elements In tmpList1
            Redim Preserve newlist(j)
            newlist(j) = Cdat(j)
            j = j + 1
      End Forall

I get out of subscript error.

I try the following:

newlist = cDat(newList)
I know though that this doesn't work because I know to change the value from text to date on each elements of the oldlist array.

I also tried to use Evaluate with @texttotime on newList and still had problems with it.

My question:
What's the simplest, most efficient way to resolve this problem and at the same time convert the newList array to short dates(without time) before assigning the value back to the field on the document?

Thank you all in advance.


0
Comment
Question by:varvoura
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 43

Expert Comment

by:Steve Knight
ID: 16910156
How about:

tmpList1 =doc.testdatefield
redim newlist (ubound(tmplist1))
for j=1 to ubound(tmplist)
  newlist(j)=cdat(oldlist(j))
next j

Can't you do it all in one too?:

tmpList =doc.testdates
     i=0
     Forall x In tmpList
          Redim Preserve oldList(i)
          oldList(i) = cdat(Format$(x, "Short Date"))
          i = i + 1
     End Forall

Steve
0
 
LVL 43

Accepted Solution

by:
Steve Knight earned 500 total points
ID: 16910161
or even
tmplist1 =doc.testdatefield
redim newlist (ubound(tmplist1))
for j=1 to ubound(tmplist)
  newlist(j)=cdat(tmplist1(j))
next j
0
 

Author Comment

by:varvoura
ID: 16918257
It is so funny, when I look closely at your code, the first "j" bit, I tried it that way as well today. If i had access to this site in the day, I would've saved you the trouble.

Much much appreciated effort
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 16918265
No problem, again thanks for the points.

Steve
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question