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

Can you store a date in a shared variable?

Status
Not open for further replies.

elf1

Technical User
Jun 6, 2001
43
US
Hi,

I am manually converting a bunch of Crystal Reports (V8.5). The database that these reports are attached to, went through a major version upgrade. Many of the actual datafile types have changed.

Evidently the file referenced below{AS_13Added_Fields_File.PermitOrdered} used to be a string field, now it is a date type.

After replacing all the old field names with the new field and running the formula checker, I got a message that “A STRING IS REQUIRED HERE” cursor stops in front of the {AS_13Added_Fields_File.PermitOrdered}.

Shared StringVar v110;

If{AS_02Service_History_Masterfil.Svc_Job_Num}="0002044" then

Shared StringVar v110 :={AS_13Added_Fields_File.PermitOrdered}

Can you store a date in a shared variable?

Thank you in advance.

Lisa
 
Any variable may be "Shared" but it has to be declared...currently you have V110 declared as a string so Crystal is expecting to see a string .

Shared DateVar v110;

If{AS_02Service_History_Masterfil.Svc_Job_Num}="0002044" then

v110 := {AS_13Added_Fields_File.PermitOrdered};

Note: having declared v110 at the beginning of the formula you don't re-declare it later on

Jim Broadbent
 
Thanks Jim. I appreciate the help.

I tried the suggested approach and I get the following error: "a variable cannot be redeclared with a different type".

Additional thoughts on this?

Lisa
 
You have to make sure that it is declared as a date in every formula that uses it. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
That's because you've used the variable v110 in other formulas, and declared it as stringvar.

Go through all the formulas which reference v110, and change them to datevar. When you try to save them, they'll give you that error. Over-ride the warning, and save them anyway. When you don't get the error anymore, you've switched all the variable types.

Naith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top