اذهب الي المحتوي
أوفيسنا

الردود الموصى بها

قام بنشر

السلام عليكم

اخواني واساتذتي الافاضل عند تنفيذ هذا الكود

للتصدير لجدول قاعدة خارجية

تظهر رسالة بالخطأ رقم 3061 ( معلمات قليلة جدا المتوقع هو 2 )

Sub exporttablefromto()
' تصدير بيانات الى جدول خارجي مع رقم تسلسلي

Dim dbOther As DAO.Database
Dim rs1 As DAO.Recordset
Dim dbCurrent As DAO.Database
Dim rs2 As DAO.Recordset
Dim intI As Integer
Dim strSQL As String
Dim intMax As Integer
    
    On Error GoTo ErrorHandler
Set dbOther = OpenDatabase([Forms]![started]![All_save_delet]![txt2Path])
Set rs1 = dbOther.OpenRecordset("N_estelamerasael", dbOpenDynaset)
Set dbCurrent = CurrentDb

strSQL = "SELECT nik_N_estelamerasael.noAccIDcash, nik_N_estelamerasael.idnoalohad , nik_N_estelamerasael.id_offic " & vbCrLf & _
", nik_N_estelamerasael.cod_num_taslsol, nik_N_estelamerasael.nopolesa, nik_N_estelamerasael.namostalem, nik_N_estelamerasael.phomostalem " & vbCrLf & _
", nik_N_estelamerasael.nammorsel, nik_N_estelamerasael.phomorsel " & vbCrLf & _
",nik_N_estelamerasael.date_input " & vbCrLf & _
", nik_N_estelamerasael.total,import_N_MoneyMoves1.codhesam1 " & vbCrLf & _
", nik_N_estelamerasael.namtadelrasael " & vbCrLf & _
", nik_N_estelamerasael.from_where " & vbCrLf & _
", nik_N_estelamerasael.albyan " & vbCrLf & _
", nik_N_estelamerasael.monydriver1 " & vbCrLf & _
", nik_N_estelamerasael.to_fragat, nik_N_estelamerasael.mony_kadasi_ersal " & vbCrLf & _
", nik_N_estelamerasael.chang_color, import_N_MoneyMoves1.albyan " & vbCrLf & _
", nik_N_estelamerasael.nopolesa, nik_N_estelamerasael.omolapolesa, nik_N_estelamerasael.nopolesaohad " & vbCrLf & _
", nik_N_estelamerasael.dd1 " & vbCrLf & _
"FROM nik_N_estelamerasael " & vbCrLf & _
"WHERE (((nik_N_estelamerasael.nopolesa)>0) AND ((nik_N_estelamerasael.addrasael)>0) AND ((nik_N_estelamerasael.no_tadel_delet)=Yes) AND ((nik_N_estelamerasael.name_open_shasha)=[Forms]![ersal_estlam]![name_open_shasha]) AND ((nik_N_estelamerasael.id_date_estelame)=[Forms]![ersal_estlam]![id_date_time])) " & vbCrLf & _
"ORDER BY nik_N_estelamerasael.nopolesa " & vbCrLf & _
"WITH OWNERACCESS OPTION;"

    Set rs2 = CurrentDb.OpenRecordset(strSQL)

    rs2.MoveLast: rs2.MoveFirst
    
    RC = rs2.RecordCount
    
    For i = 1 To RC
        rs1.AddNew

         rs1!coderesala1 = (CurrentDb.OpenRecordset("select Max([coderesala1]) from N_estelamerasael in '" & [Forms]![الاستقبال]![All_save_delet]![txt2Path] & " ' ")(0)) + 1
           rs1!noAccIDcash = rs2!noAccIDcash
           rs1!idnoalohad = rs2!idnoalohad
           rs1!id_offic = rs2!id_offic
           rs1!AccID = Me.AccID
           rs1!ArAccDes = Me.ArAccDes
           rs1!AccID1 = Me.AccID
           rs1!ArAccDes1 = Me.ArAccDes
           rs1!no_record = 0
           rs1!no_resala = rs2![nopolesa]
           rs1!no_taslsol_estelame = rs2!cod_num_taslsol
           rs1!namostalem = rs2!namostalem
           rs1!phomostalem = rs2!phomostalem
           
           rs1!nammorsel = rs2!nammorsel
           rs1!phomorsel = rs2!phomorsel
           rs1!typeresala = "0"
           rs1!noterasael = Me.typefatora
           rs1!usernam = Me.sss
           rs1!date_input = rs2!date_input
           rs1!total = rs2!total
           rs1!codhesab = Me.codhesam1
           rs1!namtadelrasael = rs2!namtadelrasael
           
           rs1!no_estelam = Me.ID
           rs1!addrasael = 1
           rs1!years = Me.years
           rs1!tarheel = -1
           rs1!fatoratasleme = Me.typefatora
           rs1!no_safha = Me.no_safha
           rs1!from_where = rs2!from_where
           rs1!no_sanad = 0
           rs1!albyan = rs2!albyan
           rs1!monydriver = -1
           rs1!codhesab1 = Me.codhesam1
           rs1!to_fragat = rs2!to_fragat
           rs1!mony_kadasi_ersal = rs2!mony_kadasi_ersal
           
           rs1!chang_color = Me.name_shasha
           rs1!rabtkaeda_close = rs2!albyan
           rs1!typ_estelam_ersal = -1
           rs1!nopolesa = rs2![nopolesa]
           rs1!coderes_tahdeth = 0
           rs1!omolapolesa = rs2!omolapolesa
           rs1!nopolesaohad = rs2!nopolesaohad
           rs1!dd1 = rs2!dd1
           rs1!dd2 = 0
           rs1!dd3 = 0
        
        rs1.Update
        rs2.MoveNext
    Next i

MsgBox "Done", vbInformation, "تبيه"
rs1.Close
Set dbOther = Nothing
rs2.Close
Set dbCurrent = Nothing

ErrorHandler:
        MsgBox "Error #: " & Err.Number & vbCrLf & vbCrLf & Err.Description
   
   End Sub
 

فما هو الحل اخواني

بارك الله فيكم وفي علمكم 

قام بنشر

الحمدلله توصلت للحل بحيث يكون الاستعلام بهذا الشكل

Set rs2 = CurrentDb.OpenRecordset("SELECT nik_N_estelamerasael.noAccIDcash, nik_N_estelamerasael.idnoalohad , nik_N_estelamerasael.id_offic," _
& " nik_N_estelamerasael.cod_num_taslsol, nik_N_estelamerasael.nopolesa, nik_N_estelamerasael.namostalem, nik_N_estelamerasael.phomostalem," _
& " nik_N_estelamerasael.nammorsel, nik_N_estelamerasael.phomorsel," _
& " nik_N_estelamerasael.date_input," _
& " nik_N_estelamerasael.total" _
& " nik_N_estelamerasael.namtadelrasael," _
& " nik_N_estelamerasael.from_where," _
& " nik_N_estelamerasael.albyan," _
& " nik_N_estelamerasael.monydriver1," _
& " nik_N_estelamerasael.to_fragat, nik_N_estelamerasael.mony_kadasi_ersal," _
& " nik_N_estelamerasael.chang_color, import_N_MoneyMoves1.albyan," _
& " nik_N_estelamerasael.nopolesa, nik_N_estelamerasael.omolapolesa, nik_N_estelamerasael.nopolesaohad," _
& " nik_N_estelamerasael.dd1," _
& " FROM nik_N_estelamerasael" _
& " WHERE ((nik_N_estelamerasael.nopolesa) > 0)" _
& " AND ((nik_N_estelamerasael.name_open_shasha)= """ & [Forms]![ersal_estlam]![ersal_estlam1]![name_shasha].Value & """)" _
& " AND ((nik_N_estelamerasael.id_date_estelame)=  #" & [Forms]![ersal_estlam]![ersal_estlam1]![id_date_time].Value & "#)" _
& " ORDER BY nik_N_estelamerasael.nopolesa;", dbOpenDynaset)
 

والبحث عن الموضع كان في هذا الموقع

https://stackoverflow.com/search?page=2&tab=Relevance&q=error 3061

فلله الحمد والمنة

واشكر اساتذتي الكرام على ما يقومون به من خدمة وتعليم اخوانهم

فجزاهم الله عنا خير الجزاء

  • Like 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

زائر
اضف رد علي هذا الموضوع....

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • اضف...

Important Information