Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

InstrRev function not defined...

Posted on 2006-06-21
15
Medium Priority
?
519 Views
Last Modified: 2011-09-20
If I input the query below directly into Access, it works - however if I try to run it inside my vb/vbs app, it fails with the error in the subject...(using ado)


 .Execute "CREATE PROC qryServerMemoryTotals AS SELECT ServerName AS [Server Name], Trim(Mid(MemID,InstrRev(MemID,'e') +1)) AS Slot, cInt(MemSize) AS [Size] FROM tblServer_RAMData WHERE MemSize <> '0' ORDER BY ServerName UNION ALL SELECT Trim(ServerName) & ' Total:' AS [Server Name], '', SUM(cInt(MemSize)) AS [Size] FROM tblServer_RAMData WHERE MemSize <> '0' GROUP BY Trim(ServerName) & ' Total:' ORDER BY [Server Name]"
0
Comment
Question by:sirbounty
[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
  • 8
  • 6
15 Comments
 
LVL 35

Accepted Solution

by:
[ fanpages ] earned 2000 total points
ID: 16951698
Does this work?

.Execute "CREATE PROC qryServerMemoryTotals AS SELECT ServerName AS [Server Name], Trim(Mid(MemID,Len(MemId)-Instr(MemID,'e')-1)) AS Slot, cInt(MemSize) AS [Size] FROM tblServer_RAMData WHERE MemSize <> '0' ORDER BY ServerName UNION ALL SELECT Trim(ServerName) & ' Total:' AS [Server Name], '', SUM(cInt(MemSize)) AS [Size] FROM tblServer_RAMData WHERE MemSize <> '0' GROUP BY Trim(ServerName) & ' Total:' ORDER BY [Server Name]"

BFN,

fp.
0
 
LVL 35

Expert Comment

by:[ fanpages ]
ID: 16951703
PS. Which version of MS-Access are you using?
0
 
LVL 35

Expert Comment

by:[ fanpages ]
ID: 16951711
"InstrRev" was only introduced in MS-Office 2000 (and Visual Basic 6).
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 67

Author Comment

by:sirbounty
ID: 16951796
Using Access 2003 - I believe it's an ADO problem more than likely (as I mentioned it works within Access).
Will try out your post and let you know...
0
 
LVL 9

Expert Comment

by:dancebert
ID: 16953259
Access string functions are available to SQL executed in Access.  When you run in VB, the Access string functions don't exist.
0
 
LVL 67

Author Comment

by:sirbounty
ID: 17047555
dancebert - missed the notif for your post - but could you elaborate why this is not available in ADO?
0
 
LVL 67

Author Comment

by:sirbounty
ID: 17080966
fp - sorry for the delay.
I've input your first post and the process runs tomorrow morning at 5am EDT.  I'll let you know soon after.
Thanx!
0
 
LVL 35

Expert Comment

by:[ fanpages ]
ID: 17081605
OK, Thanks for your update.

However, I would advise running any SQL statement in a test environment prior to deployment into a live production environment...
0
 
LVL 67

Author Comment

by:sirbounty
ID: 17081650
I don't see any way this could cause problems...
The database is created dynamically each week.  The query either works (or has been in the past - not).
It's not an update query - so what would be the reason for caution?
0
 
LVL 35

Expert Comment

by:[ fanpages ]
ID: 17081724
Because I'm a cautious person!

Why would you run any query in a live environment that had not been tested previously?

What if it took 4 hours to complete?

I wasn't aware the database was created dynamically, so it is not a huge problem if the query failed to be created, or to execute, but surely it wouldn't take long to run now to stop a failure before it happened.
0
 
LVL 67

Author Comment

by:sirbounty
ID: 17098929
Bah!  Forgot to compile it... (don't laugh!).
I'm rerunning it now though - even though it's outside of the normal weekly run, I should still know something within the hour...
0
 
LVL 35

Expert Comment

by:[ fanpages ]
ID: 17099001
Is a smile allowed aloud? :)
0
 
LVL 67

Author Comment

by:sirbounty
ID: 17099165
Sure - you can smile... heh heh...it was kind of funny...

Well, it runs - but it's not producing the output as expected.
I get

[Server Name]   |  [Slot]    |  [Size]

All slots are empty - everything else is populated correctly.
0
 
LVL 67

Author Comment

by:sirbounty
ID: 17099201
Sample table:

ServerName  |  MemID  |  MemSize  |
<MyServer>  |  Memory Device 0  |  1,024
<MyServer>  |  Memory Device 1  |  1,024
<MyServer>  |  Memory Device 2  |  1,024

Since I'm creating these fields dynamically, the field length is a bit long, thus I 'do' have some white space on the right - perhaps that's the problem here.  I count 10 'blanks' - I'll retry with a (-11) instead...
Give me another half hour or so...
0
 
LVL 67

Author Comment

by:sirbounty
ID: 17099466
Now getting
ce 4

Shaving to 8... : |
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

688 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