Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I am self-learning VB.
After writing 60 pages of VB6 code for my own program (in Win95 & Off97) (worked really nice) I upgraded to Win2K & Off2K & now it doesn't work. I tried it on Win95 & Off2K (I've let the Off97 CD go) & it still doesn't work. So what is it about Off2K that I need to do?

That actually sounds like VBA (VB for Applications), not straight VB. VBA is a group of add-on libraries used by the Office suite, that uses the VB syntax to create scripted routines, to customise certain chores. It does not make use of most VB objects, nor is a compiler supplied, yet it is incredibly flexible and handy.
VB normally only uses the "shared" set of VBA routines (math, string, collection, and other general routines found in the primary runtime, MSVBVMx0.dll), so it would not be affected by Office. However, if you explicitly used Office objects within VB6 iteself, then you might be missing the Office97 DLLs (like MSO.dll) that your project would be looking for. Although the VBA DLLs tend to be backwards-compatible (never drop old stuff, just add new), you might need to re-reference the newer Office DLLs in your VB6 app, and recompile. Otherwise, perhaps you can grab the older set of DLLs, and register them on your computer.
If you can verify if you're referring to VB6 with/without VBA, or pure VBA, perhaps I could be more helpful.
Cheers

thanks:
I am using VB6 - writing code to call up a database. I get stuck with an error message:
Run Time Error 3061
Too few parameter: expected 1
Debugged to:
Set rs = db.OpenRecordset(strSQL,OpenDunaset)
At first it did not recognise the database but I converted it to an older version.

ignore typos - of course OpenDynaset is correct in the code.
The only connection to Office is that I am calling an Access database.
Immediately after the upgrade I found my listbox had changed into a picture box. So I've gradually gotten my code to work step by step but I can't get past this error message.
It calls all the records to the listbox now but when I filter them with an sql query to the listbox I get the message.

Ah, the infamous "VB can't find the library that supports this kind of control, so a PictureBox will be substituted for absolutely no sensible reason whatsoever, the user will not be told, and there is no away to avoid said automatic conversion." Your VB project couldn't find a previously-used library (DLL or OCX), so substitutions were made. Sounds like you fixed most of it, but for some reason DAO either expected only one parameter for .OpenRecordset, or could not recognise one of the parameter types. The latter seems most likely, unless for some odd reason ADO is in the mix or whatever. I assume by "OpenDynaset" you meant the constant "dbOpenDynaset", and that strSQL was declared As String, and not an generic object.
If you highlight the opening parenthesis after OpenRecordset, and retype it, how many parameters popup as available? I believe DAO 3.5/3.6 require at least 2, as your code indicates.

Make sure "Option Explicit" is the first line at the top of every code file, and try checking the types of the parameters, just before the call:
If VarType(strSQL) < > vbString Then _
MsgBox "strSQL is not interpreted as string"If (VarType(dbOpenDynaset) And vbInteger) = 0 Then _
MsgBox "dbOpenDynaset is not interpreted as an integer"I know this seems strange, but it's possible Variant confusion has crept in (which is why they have been eliminated from the language along with COM). Also, try doing a full compile (CTRL+F5) and seeing if anything else is throwing a wrench into the works.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |