• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 608
  • Last Modified:

Error message Run-time error ‘-2147217904

Hello all,

I have a application in VB6, and it's searching into an access dbase.

On my pc, i don't have any error but when i install on another pc, i have this error:
Run-time error ‘-2147217904
No value given for one or more required parameters

What does that mean and what do i need to do to be able to fix this?

Thanks again for your help.


If ComDateDisponible = "" Then
ComDateDisponible.SetFocus
MsgBox "Entrer une date de distribution"

Else

If ComEmployé = "" Then
ComEmployé.SetFocus
MsgBox "Entrer un nom d'employé"

Else

If Des_prod = "" Then
Des_prod.SetFocus
MsgBox "Entrer un nom de produit assigné à cette employé"

Else


Form11.Show Modal


'entré de donné

Form11.txtPeriode.Text = Form12.ComDateDisponible.Text

Form11.txtEmployé.Text = Form12.ComEmployé.Text

Form11.ComDescriptionDe.Text = Form12.Des_prod.Text

Dim sSQL1 As String
 Dim oRST1 As ADODB.Recordset
  Set oRST1 = New ADODB.Recordset
    Dim oConnect1 As ADODB.Connection
  Set oConnect1 = New ADODB.Connection




 sSQL1 = "SELECT [Période],[Employé],[No_Bon],[Description_du_produit],[Coût_unitaire],[Par_tranche_de],[Quantité_assignée],[Quantité_assignée_ajustée],[Montant_assemblage] ,[Surplus] ,[Montant_ajusté] ,[Composante1] ,[Quantité1] ,[Quantité1_ajustée],[Composante2],[Quantité2],[Quantité2_ajustée],[Composante3] ,[Quantité3] ,[Quantité3_ajustée] ,[Composante4],[Quantité4],[Quantité4_ajustée],[Composante5] ,[Quantité5] ,[Quantité5_ajustée] ,[Nombre_étape] ,[Opération_1],[Opération_2] ,[Opération_3],[Montant_surplus],[Commentaire] FROM [Distribution_employé] WHERE " _
            & "Période ='" & Form12.ComDateDisponible.Text & "' AND " _
            & "Employé ='" & Form12.ComEmployé.Text & "' AND " _
            & "Description_du_produit ='" & Form12.Des_prod.Text & "'"
            
            oConnect1.Open "Provider=Microsoft.ACE.OLEDB.12.0;" & _
            "Data Source=" & Form4.txtBaseDe.Text & ";"


oRST1.Open sSQL1, oConnect1



          Set Form11.txtNumDe.DataSource = oRST1
        Form11.txtNumDe.DataField = "No_Bon"
        
        Set Form11.txtCoûtUnitaire.DataSource = oRST1
        Form11.txtCoûtUnitaire.DataField = "Coût_unitaire"
        
        Set Form11.txtParTranche.DataSource = oRST1
        Form11.txtParTranche.DataField = "Par_tranche_de"
        
        Set Form11.txtQtéAssignée.DataSource = oRST1
        Form11.txtQtéAssignée.DataField = "Quantité_assignée"
        
        Set Form11.txtQtéAssignéeAjustée.DataSource = oRST1
        Form11.txtQtéAssignéeAjustée.DataField = "Quantité_assignée_ajustée"
        
        Set Form11.txtQtéAssignéeAjustée2.DataSource = oRST1
        Form11.txtQtéAssignéeAjustée2.DataField = "Quantité_assignée_ajustée"
        
        
        Set Form11.txtMontantDe.DataSource = oRST1
        Form11.txtMontantDe.DataField = "Montant_assemblage"
        
        Set Form11.txtMontantSupplémentaire.DataSource = oRST1
        Form11.txtMontantSupplémentaire.DataField = "Surplus"
        
        Set Form11.txtMontantAss.DataSource = oRST1
        Form11.txtMontantAss.DataField = "Montant_ajusté"
        
        Set Form11.txtCommentaire.DataSource = oRST1
        Form11.txtCommentaire.DataField = "Commentaire"
        
        
        
        
         Set Form11.ComposanteNo1.DataSource = oRST1
        Form11.ComposanteNo1.DataField = "Composante1"
        
         Set Form11.txtQuantité1.DataSource = oRST1
        Form11.txtQuantité1.DataField = "Quantité1"
        
         Set Form11.txtQuantité1Ajustée.DataSource = oRST1
        Form11.txtQuantité1Ajustée.DataField = "Quantité1_ajustée"
        
         Set Form11.ComposanteNo2.DataSource = oRST1
        Form11.ComposanteNo2.DataField = "Composante2"
        
         Set Form11.txtQuantité2.DataSource = oRST1
        Form11.txtQuantité2.DataField = "Quantité2"
        
         Set Form11.txtQuantité2Ajustée.DataSource = oRST1
        Form11.txtQuantité2Ajustée.DataField = "Quantité2_ajustée"
        
         Set Form11.ComposanteNo3.DataSource = oRST1
        Form11.ComposanteNo3.DataField = "Composante3"
        
         Set Form11.txtQuantité3.DataSource = oRST1
        Form11.txtQuantité3.DataField = "Quantité3"
        
        Set Form11.txtQuantité3Ajustée.DataSource = oRST1
        Form11.txtQuantité3Ajustée.DataField = "Quantité3_ajustée"
        
         Set Form11.ComposanteNo4.DataSource = oRST1
        Form11.ComposanteNo4.DataField = "Composante4"
        
         Set Form11.txtQuantité4.DataSource = oRST1
        Form11.txtQuantité4.DataField = "Quantité4"
        
        Set Form11.txtQuantité4Ajustée.DataSource = oRST1
        Form11.txtQuantité4Ajustée.DataField = "Quantité4_ajustée"
        
        Set Form11.ComposanteNo5.DataSource = oRST1
        Form11.ComposanteNo5.DataField = "Composante5"
        
         Set Form11.txtQuantité5.DataSource = oRST1
        Form11.txtQuantité5.DataField = "Quantité5"
        
        Set Form11.txtQuantité5Ajustée.DataSource = oRST1
        Form11.txtQuantité5Ajustée.DataField = "Quantité5_ajustée"
        
        
        
        Set Form11.txtNombreD.DataSource = oRST1
        Form11.txtNombreD.DataField = "Nombre_étape"
        
        On Error Resume Next
        
        Set Form11.ComOpération1.DataSource = oRST1
        Form11.ComOpération1.DataField = "Opération_1"
        
        Set Form11.ComOpération2.DataSource = oRST1
        Form11.ComOpération2.DataField = "Opération_2"
        
        Set Form11.ComOpération3.DataSource = oRST1
        Form11.ComOpération3.DataField = "Opération_3"
        
        
       
        
        
       If (Val(Form11.txtQtéAssignéeAjustée)) < (Val(Form11.txtQteDispon)) Then
Form11.txtQtéAssignéeAjustée.BackColor = QBColor(15)
Form11.txtQtéAssignéeAjustée.ForeColor = QBColor(0)
Else
Form11.txtQtéAssignéeAjustée.BackColor = QBColor(12)
Form11.txtQtéAssignéeAjustée.ForeColor = QBColor(14)
'MsgBox "Vous avez dépassé le nombre disponible en inventaire de: " & (Val(Form11.txtQtéAssignéeAjustée)) - (Val(Form11.txtQteDispon))
End If

        

End If
End If
End If

'************************* INVENTAIRE *************************
Dim sSQL9 As String
 Dim oRST9 As ADODB.Recordset
  Set oRST9 = New ADODB.Recordset
    Dim oConnect9 As ADODB.Connection
  Set oConnect9 = New ADODB.Connection




 sSQL9 = "SELECT [Période],[Description_du_produit],[Quantité_distribuée],[Quantité_commandée_ajustée] FROM [Inventaire] WHERE " _
            & "Période ='" & Form12.ComDateDisponible.Text & "' AND " _
            & "Description_du_produit ='" & Form12.Des_prod.Text & "'"
            
            oConnect9.Open "Provider=Microsoft.ACE.OLEDB.12.0;" & _
            "Data Source=" & Form4.txtBaseDe.Text & ";"


oRST9.Open sSQL9, oConnect9



          Set Form11.txtQteDistribue.DataSource = oRST9
        Form11.txtQteDistribue.DataField = "Quantité_distribuée"
        
         Set Form11.txtCommandeQteInventaire.DataSource = oRST9
        Form11.txtCommandeQteInventaire.DataField = "Quantité_commandée_ajustée"
        
       
        
        Form11.txtQteDispon = Val(Form11.txtCommandeQteInventaire.Text) - Val(Form11.txtQteDistribue.Text)
        
        If (Val(Form11.txtQtéAssignéeAjustée)) > (Val(Form11.txtQteDispon)) Then
Form11.txtQtéAssignéeAjustée.BackColor = QBColor(12)
Form11.txtQtéAssignéeAjustée.ForeColor = QBColor(14)
Else
Form11.txtQtéAssignéeAjustée.BackColor = QBColor(15)
Form11.txtQtéAssignéeAjustée.ForeColor = QBColor(0)
End If

        


Unload Form12


        
         'Si supprimé
          Form11.txtQteInventaireSiSupprime = Val(Form11.txtQteDistribue.Text) - Val(Form11.txtQtéAssignéeAjustée2.Text)
        
        
       
End Sub

Open in new window


0
Wilder1626
Asked:
Wilder1626
  • 10
  • 5
  • 4
2 Solutions
 
HainKurtSr. System AnalystCommented:
on which line do you get this?
0
 
GrahamSkanRetiredCommented:
This error is caused by there being something in the SQL that is not understood, so the process assumes that it is because of a parameter which has not been provided.

I suggest that you look at what the SQL resolves to when you get the error. It might help to log the text to a file:
WriteLog "sSQL1: " & sSQL1
oRST1.Open sSQL1, oConnect1

'....
WriteLog "sSQL9: " & sSQL9
oRST1.Open sSQL9, oConnect9

'....


Sub WriteLog(ByVal Text As String)
    Dim f As Integer
    Dim strFileName As String
    strFileName = "MyLog" & Format$(Now, "MMy") & ".log"
    Text = Format$(Now, "HH:nn:ss") & " " & Text
    Debug.Print Text
    f = FreeFile
    Open App.Path & "\" & strFileName For Append As #f
        Print #f, Text
    Close #f
End Sub

Open in new window

0
 
Wilder1626Author Commented:

Hello to both of you.

HainKurt, it hard to tell since it's working on my PC but not under somebody's PC and once all compiles .exe.

But has soon has i click on the button that contain the code in my first post, that the only thing i see, the run time error.

GrahamSkan, do i need to paste your code in my code from my first post?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
GrahamSkanRetiredCommented:
You need to paste the WriteLog Sub as a separate procedure. It can go in the same module.

You need to put the two calls to the Sub inside your existing code in the two places where you open the recordsets as indicated in the two mini-snippets.

0
 
Wilder1626Author Commented:
Hello again.

Ok, i just did it and here is my result:
18:59:19 sSQL1: SELECT [Période],[Employé],[No_Bon],[Description_du_produit],[Coût_unitaire],[Par_tranche_de],[Quantité_assignée],[Quantité_assignée_ajustée],[Montant_assemblage] ,[Surplus] ,[Montant_ajusté] ,[Composante1] ,[Quantité1] ,[Quantité1_ajustée],[Composante2],[Quantité2],[Quantité2_ajustée],[Composante3] ,[Quantité3] ,[Quantité3_ajustée] ,[Composante4],[Quantité4],[Quantité4_ajustée],[Composante5] ,[Quantité5] ,[Quantité5_ajustée] ,[Nombre_étape] ,[Opération_1],[Opération_2] ,[Opération_3],[Montant_surplus],[Commentaire] FROM [Distribution_employé] WHERE Période ='27 avril 2011' AND Employé ='JEAN-MARC, ' AND Description_du_produit ='TEST1'


18:59:19 sSQL9: SELECT [Période],[Description_du_produit],[Quantité_distribuée],[Quantité_commandée_ajustée] FROM [Inventaire] WHERE Période ='27 avril 2011' AND Description_du_produit ='TEST1'

Open in new window


Do you see something wrong?


0
 
Wilder1626Author Commented:
i was able to test on another PC again.

The error is:

Run-Time error 545

Run-time-error.jpg
0
 
Wilder1626Author Commented:
I was readyn on the web about: AllowEarlyOpen property

Could that be the issue?

What is that: AllowEarlyOpen property?
0
 
HainKurtSr. System AnalystCommented:
maybe the problem is this

Période ='27 avril 2011'

make sure regional settings are same (control panel-regional settings)

0
 
HainKurtSr. System AnalystCommented:
also make sure access components are installed on other macjines (maybe MDAC)
0
 
HainKurtSr. System AnalystCommented:
also try to reinstall this on other machin es

http://www.microsoft.com/downloads/en/details.aspx?FamilyID=c06b8369-60dd-4b64-a44b-84b371ede16d&displaylang=en

Microsoft Access Database Engine 2010 Redistributable
0
 
GrahamSkanRetiredCommented:
I would suggest using date types, rather than strings for date passing, though it seems to have been accepted in the first query.

It might help to copy the SQL from what I presume to be the failing line and to paste it into the SQL view of the Access query design, just to see if it runs there.

SELECT [Période],[Description_du_produit],[Quantité_distribuée],[Quantité_commandée_ajustée] FROM [Inventaire] WHERE Période ='27 avril 2011' AND Description_du_produit ='TEST1'

0
 
Wilder1626Author Commented:
Hello all

HainKurt, I have downloaded the the link but i still have the same error.

GrahamSkan, i may sound weird but i don't understand how to:paste it into the SQL view of the Access query design.

Can you please guide me on that?
0
 
GrahamSkanRetiredCommented:
Open your database in the Access application. Open the Query Design window. In Access 2007, it's on the Create tab.

Dismiss the Show Table window. The view choices are on the right, and it will probably now be at the SQL view. The other view choices include Design view and Datasheet view.
0
 
Wilder1626Author Commented:
Ok, i will try this later and i will let you know.

Thanks
0
 
Wilder1626Author Commented:
Ok,

it look's like i don't have the SQL view.
0
 
Wilder1626Author Commented:
Great, i now how to do it now.

I tried both SQL
18:59:19 sSQL1: SELECT [Période],[Employé],[No_Bon],[Description_du_produit],[Coût_unitaire],[Par_tranche_de],[Quantité_assignée],[Quantité_assignée_ajustée],[Montant_assemblage] ,[Surplus] ,[Montant_ajusté] ,[Composante1] ,[Quantité1] ,[Quantité1_ajustée],[Composante2],[Quantité2],[Quantité2_ajustée],[Composante3] ,[Quantité3] ,[Quantité3_ajustée] ,[Composante4],[Quantité4],[Quantité4_ajustée],[Composante5] ,[Quantité5] ,[Quantité5_ajustée] ,[Nombre_étape] ,[Opération_1],[Opération_2] ,[Opération_3],[Montant_surplus],[Commentaire] FROM [Distribution_employé] WHERE Période ='27 avril 2011' AND Employé ='JEAN-MARC, ' AND Description_du_produit ='TEST1'


18:59:19 sSQL9: SELECT [Période],[Description_du_produit],[Quantité_distribuée],[Quantité_commandée_ajustée] FROM [Inventaire] WHERE Période ='27 avril 2011' AND Description_du_produit ='TEST1'

Open in new window



And there is no error
0
 
Wilder1626Author Commented:
Do you know what, i just rebuild the form with that SQL query, and now it look's like it work on another PC.

I don't know why!!!!!! Maybe a corrupt form!!!!!!!

Let me test again on another PC, just to be sure.
0
 
Wilder1626Author Commented:
Hello all,

Thank you so much for your help. With you gyus, i was able to see that one of the access dbase had a column missing.

Now, everything is working.

Thanks again and havea great week-end.
0
 
GrahamSkanRetiredCommented:
Phew. That's a relief. Well done and good luck.
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 10
  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now