Click here to Skip to main content
15,900,725 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

In VB6.0, InStr() function and DateAdd() functions are working correctly in Run as Administrator mode. The same is showing error in Normal mode. What is the problem? How to execute those functions in normal mode also. Please help me.....

What I have tried:

I uninstall and Install Visual studio 6.0 software then only it is running successfully in Administrator mode.
Updated 29-Sep-20 0:19am
Richard Deeming 29-Sep-20 6:31am    
NB: VB6 has been dead for almost 20 years now. Unless you're maintaining an existing ancient application, you should look at using a more modern language for your development instead.
CHill60 29-Sep-20 11:15am    
What is the error that is shown? And share the code that is producing it
Member 10556393 30-Sep-20 8:08am    
The error is Invalid procedure call or argument in DateAdd("m",-1,"2020/09/29") function.

1 solution

It's very unlikely that either InStr or DateAdd would require admin privileges: they are just function called in the VB6 framework and don't access anything outside the app.

So, the possibilities:
1) Your system or your app is infected with something nasty which tries to access privileged data.
2) The code that uses InStr and DateAdd also tries to do something that requires elevation: read or write a file in an "unusual location" for example.
3) The code that uses InStr and DateAdd is located in a privileged folder and can't be executed without elevation as a result.

Start with the first: not because it's the most likely, but because it's the easiest to spot and the biggest risk.

Then check the others: bear in mind that in release, apps are installed in read only folders below Program Files for security, so code which uses data in the exe folder will work in development but may fail in production.

If you really can't work it out, create a bare minimum application (console app, couple of lines of code maximum) that still shows the problem, and show that complete code so we can try to replicate it here.
Share this answer
Member 10556393 29-Sep-20 6:48am    
Your answer is not understanding. Can you please explain clearly?
OriginalGriff 29-Sep-20 6:59am    
That's about as clear as I can make it without being in the same room as you - what parts do and don't make sense?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900