Results 1 to 2 of 2
  1. #1
    Join Date
    May 2014
    Posts
    4

    Unanswered: i need help urgently , thanks

    I have this db and for automtic sending emil based on query to send asingle record to specific contact email
    but I have a problem with SELECT with a message said ( too few parameters . expected1) i do not know how to solve that

    Private Sub Command6_Click()
    'Dim MYDB As Database, RST11 As Recordset, rstemp As Recordset, mto As String, empstring As String, sqlstring As String, memp As string, med As string
    Dim MYDB As dao.Database, RST11 As Recordset, rstemp As Recordset, mto As String, empstring As String, sqlstring As String, mco As String, memp As String, med As String
    Dim Qdf As QueryDef
    Dim prm As Parameter
    Set MYDB = CurrentDb
    empstring = "SELECT distinct payroll,id FROM allownceQuery where id = id"
    Set rstemp = MYDB.OpenRecordset(empstring, dbOpenDynaset)
    rstemp.MoveFirst
    While Not rstemp.EOF
    memp = rstemp("payroll")
    med = rstemp(id)
    Set Qdf = MYDB.QueryDefs("allownceQuery")
    sqlstring = "SELECT allownce1.payroll,personal.al-name,personal.field,allownce1.allawnce, allownce1.amount,"
    sqlstring = sqlstring & " allownce2.date, allownce2.id,balance.balance FROM (((personal inner join allownce1 on personal.payroll = allownce1.payroll),"
    sqlstring = sqlstring & " inner join allownce2 on allownce1.id = allownce2.id)"
    sqlstring = sqlstring & " inner join balance on allownce1.payroll = balance.payroll)"
    sqlstring = sqlstring & " WHERE personal.email like '*Khalda*' and personal.payroll = " & memp & " and allownce1.id = '" & med & "'"
    sqlstring = sqlstring & " ORDER BY personal.payroll"
    Qdf.SQL = sqlstring
    Qdf.Close
    'For Each prm In Qdf.Parameters
    'prm.Value = Eval(prm.NAME)
    'Next prm
    Set RST11 = Qdf.OpenRecordset
    RST11.MoveFirst
    'While Not RST11.EOF
    'combo_emp.RowSource = "SELECT EMPID,EMPNAME FROM employee WHERE COMPANY = '" & RST11("COMPANY") & "' AND EMPID = " & RST11("EMPID")
    mto = RST11("email")
    RST11.Close
    DoCmd.SendObject acSendQuery, "allownceQuery", acFormatXLS, mto, , , " allowances added to payroll", "attached is your allowances payment", False
    rstemp.MoveNext
    Wend
    MsgBox "EMAIL PROCESS COMPLETE", vbInformation
    MYDB.Close
    End Sub

  2. #2
    Join Date
    Apr 2012
    Posts
    1,035
    Provided Answers: 18
    programming error.

    Study IBM's example vb code in the SAMPLES tree of your db2 server, in the subdirectories WMI, .NET and OLE. Get one or more of these samples working with Your unspecified version of db2 and your unspecified version of Windows and learn from these.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •