Solved

InstrRev function not defined...

Posted on 2006-06-21
15
489 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
  • 8
  • 6
15 Comments
 
LVL 35

Accepted Solution

by:
[ fanpages ] earned 500 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
 
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…

707 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now