Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Compile Error..... Ucase(chr$......

Posted on 2000-04-11
19
Medium Priority
?
715 Views
Last Modified: 2012-05-04
I wrote a database and gave a copy to a friend. He keeps getting Compile Error and VB goes to code and highlights a Ucase(Chr$... statement. Obviously the relevent addin/module whatever for the Ucase function is not included in his Tools->References ..... can someone please tell me which one is needed for this function? I cant tell from my setup
Running Access 2000...
0
Comment
Question by:pbetts
  • 7
  • 7
  • 2
  • +3
19 Comments
 
LVL 7

Expert Comment

by:Believer
ID: 2706219
I think a reference in general is missing, not just the UCase-specific one.  Walk your friend thru getting to a code module, then check the references.  You'll probably find that one's missing and hopefully it's just a matter of telling it where the file is.  
0
 
LVL 9

Accepted Solution

by:
BrianWren earned 800 total points
ID: 2706263
UCase() and Chr() are in:

     Visual Basic For Applications

file

     C:\PROGRAM FILES\COMMON FILES\MICROSOFT SHARED\VBA\VBA332.DLL

have your friend open a module design window, and from the menu select "Tools | References..." and make sure that "Visual Basic For Applications" is present and checked.  If not, scroll dow to find it.  If it is there but unchecked, chek the box beside it.  

If it is not there, click the Browse button, and search for the file.

Brian




0
 

Author Comment

by:pbetts
ID: 2706353
... I did that, he says VB for Applications is checked
{
Peter
yes i do have Visual basics for applications, its the first one and it is marked in the little box.
Do you think I might not have saved our alterations saturday nite?
}

.... i got him to rem out the line and it worked ok then, now its back !!! If rem-ming the line worked then it still leaves the problem. Im no expert, I just added a heap of libraries to mine until it worked..... I wld like to know what I am doing this time :)


0
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
LVL 14

Expert Comment

by:mgrattan
ID: 2706377
While you're in the Tools|References box make sure none of the checked references has MISSING: in its description.  If it does, then uncheck the reference, close the window, then go back into Tools|References and re-select the reference if it is needed.

0
 

Author Comment

by:pbetts
ID: 2706402
... I did that, he says VB for Applications is checked
{
Peter
yes i do have Visual basics for applications, its the first one and it is marked in the little box.
Do you think I might not have saved our alterations saturday nite?
}

.... i got him to rem out the line and it worked ok then, now its back !!! If rem-ming the line worked then it still leaves the problem. Im no expert, I just added a heap of libraries to mine until it worked..... I wld like to know what I am doing this time :)


0
 
LVL 9

Expert Comment

by:BrianWren
ID: 2706516
OK then, I think that there is something else wrong with that line.  Can you post the entire statement?

One thing to try is to start unpacking that statement.  If you have for instance:

     For i = 65 to 70
          Debug.Print UCase(Chr$(i + 2))
     Next i

Then try:

     Dim k as integer
     For i = 65 to 70
          k = i + 2
          Debug.Print UCase(Chr$(k))
     Next i

Then

     Dim k as integer
     Dim s as string
     For i = 65 to 70
          k = i + 2
          s = Chr$(k)
          Debug.Print UCase(s)
     Next i

Etc.

Brian
0
 

Author Comment

by:pbetts
ID: 2706897
hmmm.. the statement works fine on my PC here and at home... I have been using the database for nearly 3 years. Its only when i sent it to him that we got the error. I have many instances of Ucase() the same, and all work fine. I'm thinking the error he reported after we remmed the first one was another instance of Ucase... but he isnt online  yet to ask.   I will make sure he has the correct .DLL  for VB /Apps and get back soon.... stay tuned.....
0
 
LVL 3

Expert Comment

by:MikeRenz
ID: 2707176
how about


  UCase(cStr(chr$(___)))

0
 
LVL 9

Expert Comment

by:BrianWren
ID: 2708271
Sometimes, (the why of which I'm not that clear on...), syntax gets really, really picky.

For instance, let's say you had:

   Var$ = (UCase(Chr$(KeyAscii)))

Sometimes, (I'm not sure when), this won't work, but

   Var$ = UCase(Chr$(KeyAscii))

will.  Or

   Var$ = UCase$(Chr$(KeyAscii))

Surrounding a statement with parens would seem to mean nothing, since in algebra it does mean nothing, (  A = 1 + 2  is the same as  A = (1 + 2), dor instance).  But in VBA, surrounding a statement with parens indicates implicit typing.  For instance, if you had the function:

Function ABC(i as integer) As string
End Function

And you had also

    Dim t as Double
       .
       .
       .
     str = ABC(t)

you would get a type mismatch, but

    str = ABC((t))

will work, because the extra parens implicitly type 't' as an integer.

Plus, The prototype of Ucase() in the object browser is:

    Function UCase(String)

but the prototype of UCase$() is

    Function UCase$(String As String) As String

With the '$' all of the variables are explicitly strings.  

Who knows?  Might make the difference...

What does the db do if you open this module for design on the machine it's not working on, and click the 'Compile' button on the toolbar?

Brian
0
 
LVL 9

Expert Comment

by:BrianWren
ID: 2708284
BTW:

 •   Have you tried making a backup copy, then repairing the one that doesn't work?

 •   Have you tried creating a new DB and importing all of the objects of the failing DB into the new one to see if the new one has the same problem?
0
 
LVL 7

Expert Comment

by:Believer
ID: 2708611
Brian: Neato!  How'd you get those bullets? <grin>  Seriously!
0
 
LVL 9

Expert Comment

by:BrianWren
ID: 2708898
I didn't get them from Smith and Wesson!  (What idiots...)

Hold down the alt key, type, in order, 0 1 4 9, then let the alt key up.  I used spc Alt+0149 spc spc spc.

alt +

0187    »        0215    ×
0162    ¢        0247    ÷
0148    ”        0147    “
0189    ½        0190    ¾
0188    ¼        0186    º

and so on.  If you open character map, and select one of the bottom half characters, in the status bar, the combination is shown.
0
 
LVL 9

Expert Comment

by:ornicar
ID: 2709333
Hi! pbetts,
Did you try 2nd BrianWren's suggestion?
I got the same problem, no way to get rid of it by playing with the librairies. I think the only successful way was creating a new database, check if I can write these statements and if yes, importing all objects from the bad database.
0
 

Author Comment

by:pbetts
ID: 2720221
Thanks guys.......
OK..... I had him open a form in design mode, View->code
Debug->Compile and this is what he mailed me :
Peter
***********
 I did what you advised opened up several forms, one at a time, From code window  I selected Debug>compile race.  Screen went to "compile error  can't find project,  high lited   Mid$
clicked & then it went to  references,all top items ticked.

  Then I reinstalled Office  2000.

Started the program  however same thing happened.  went to Micobasics  and highlited Ucase.
*************
He swears VB for Apps is checked ( 1st itme in references)..... cld he have an older version of VBA332.DLL ???
Mine is dated 17/11/96 ( which seems kinda old???? ) Version 3.0.7019

I will recreate the database via new one and import all the objects and send it to him. I could step him through it I suppose, but it took an hour to get him to check the references :(



0
 

Author Comment

by:pbetts
ID: 2722240
?What Library - simple question hahaha
The original question was answered by Brian. so he gets the nod.
As for the continuing problem, thanks to all. Thanks ornicar for suggesting I tried brians 2nd suggestion. I "recreated" the database, recompiled it and sent it on using WINRAR.sfx ( rather than Winzip, dunno why). Lo and Behold!!! It worked. I guess we still dont know exactly WHY it worked, but then if we did there'd be no fun anymore would there !
Peter Betts.... today a happy little camper :)
0
 
LVL 9

Expert Comment

by:BrianWren
ID: 2723780
Great!  I was wondering about the outcome and solutions on this one...

Brian
0
 

Author Comment

by:pbetts
ID: 2746966
Brian..... did you get 200 points?????
It shows you only got 20!!!!!!. We all saw it was posted for 200 points, and that is what was taken off my available points. The last time you answered a question for me for 100 you only got 10. Please let me know and I will contact the help people if it is so......

Peter Betts.....



0
 
LVL 9

Expert Comment

by:BrianWren
ID: 2747992
Peter,

    Once an answer is accepted, the value of the question goes to 10% of the original.  When it says 20 pts, I can have gotten the results of an original 196 to 204 pts.  (When the 'grade' is 'A', the person who answered gets 4 times that much.  For a 'B', the multiplier is 3, etc.)

    So. I got the points.  Thank you so much for your concern!  (A rare thing these days...)

Brian

0
 

Author Comment

by:pbetts
ID: 2754168
Thanks Brian, I suppose this was in the FAQ somewhere..... but hey.... who gets the time :)

Peter Betts
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Windows Explorer let you handle zip folders nearly as any other folder: Copy, move, change, and delete, etc. In VBA you can also handle normal files and folders, but zip folders takes a little more - and that you'll find here.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

886 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