Solved

InstrRev function not defined...

Posted on 2006-06-21
15
495 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Sending a email via excel using vba 6 71
VB6 - Convert HH:MM into Decimal 8 51
fso.FolderExists("\\server\HiddenFolder$") 4 49
Advice in Xamarin 21 52
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

911 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