Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21842

W7 - vb6-98 - access - excel - error 3061

$
0
0
VB6 (32 BIT - 1998) ERROR 3061 - WINDOWS 7 - ACCESS 2007 - EXCEL 2007

I wrote a VB6 program that extracts records from an ACCESS 2007 database and writes them into an EXCEL 2007 sheet.

The program worked fine and I used the exe for several months. Then, mayhem happended.
A new 1GB HD I installed as "C" commited suicide and developed a permanent error.
My secondary 2 GB "D" also developed a simultaneous permanent error.
Bye bye system.

I was able to recover everything. Put in new hard drives (warranty provided them). Reinstalled W7, ACCESS 2007, EXCEL 2007 and VB6, all from CD.

Now, when I run my VB exe, gives me runtime error 3061 - too few parameters - at least 1 was expected.

The culprit is the select, and I can not find any error in it:

Set rs = db.OpenRecordset(Select_str)

THE SELECT CONTAINS:

SELECT HORA, ARL, ARL_ECON, ESTADO_OPE, EST_REMUN, ENERGIA, POT_DISP, POT_RECORTADA, PIND, PINDFORZ, CGN, CGO, CFO, CCM, PRECIO_NODO, PR_REM_ENERGIA, SCTD, SCO, COSTO_406, COMPRA_SPOT, POT_DISP_RESERVA, POT_DISP_GAS, GAS_NOMINADO, REM_ADICIONAL, REM_ADIC_TOTAL, DESP_ECON, PGENE_COMP_446, REM_ADIC_COMP_446, REM_GAS_6866, REMUN_ADIC_6866, POT_DISP_ACD FROM VALORES_GENERADORES WHERE GRUPO = "XXXXXX"

I build the select this way:

BeguinSelectString$ = "SELECT HORA, "
DE$ = " FROM "
Donde$ = " WHERE GRUPO = " + Chr(34)
FinDelSelect$ = Chr(34) + " "

Select_str = ""

' I BUILD THIS SELECT WITH A DO TO LIST ALL FIELDS AND PUT THEM IN THE SELECT.

Select_str = BeguinSelectString$

For i = 0 To (Max_Index_de_Records_1 - 1)

Select_str = Select_str + Nombres_de_Campos_1(i) + ", "

Next i

Select_str = Select_str + Nombres_de_Campos_1(Max_Index_de_Records_1) ' I INSERT THE LAST FIELD WITHOUT THE COMMA, ELSE IT GIVES AN ERROR

Select_str = Select_str + _
DE$ + _
Tabla + _
Donde$ + _
sNombre_del_Grupo + _
FinDelSelect$

THE PROJECT REFERENCES ARE, in this order:

1) Visual Basic for Applications
2) Visual Basic runtime objects and procedures
3) Visual Basic objects and procedures
4) ActiveBar control
5) ActiveEx type library
6) Microsoft DAO 3.6 Object Library
7) Microsoft Excel 12.0 Object Library
7) Microsoft Access 12.0 Object Library
7) Microsoft Office 12.0 Object Library

Any clue/help will be welcome.

Thanks in advance.

Rudy.

Viewing all articles
Browse latest Browse all 21842

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>