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

    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)
    While Not rstemp.EOF
    memp = rstemp("payroll")
    med = rstemp(id)
    Set Qdf = MYDB.QueryDefs("allownceQuery")
    sqlstring = "SELECT allownce1.payroll,,personal.field,allownce1.allawnce, allownce1.amount,"
    sqlstring = sqlstring & ",,balance.balance FROM (((personal inner join allownce1 on personal.payroll = allownce1.payroll),"
    sqlstring = sqlstring & " inner join allownce2 on ="
    sqlstring = sqlstring & " inner join balance on allownce1.payroll = balance.payroll)"
    sqlstring = sqlstring & " WHERE like '*Khalda*' and personal.payroll = " & memp & " and = '" & med & "'"
    sqlstring = sqlstring & " ORDER BY personal.payroll"
    Qdf.SQL = sqlstring
    'For Each prm In Qdf.Parameters
    'prm.Value = Eval(prm.NAME)
    'Next prm
    Set RST11 = Qdf.OpenRecordset
    'While Not RST11.EOF
    'combo_emp.RowSource = "SELECT EMPID,EMPNAME FROM employee WHERE COMPANY = '" & RST11("COMPANY") & "' AND EMPID = " & RST11("EMPID")
    mto = RST11("email")
    DoCmd.SendObject acSendQuery, "allownceQuery", acFormatXLS, mto, , , " allowances added to payroll", "attached is your allowances payment", False
    MsgBox "EMAIL PROCESS COMPLETE", vbInformation
    End Sub

  2. #2
    Join Date
    Apr 2012
    Provided Answers: 25
    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