اذهب الي المحتوي
أوفيسنا
بحث مخصص من جوجل فى أوفيسنا
Custom Search

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

قام بنشر

السلام عليكم

ارجو المساعدة في مشكل run-time error 3021
اريد تغيير "No" ب "Yes"  في الحقل Replaced  الجدول tblEmployees
الكود :
Private Sub AddNew_Click()
Dim strMsg As String, strTitle As String
Dim strMsgNo As String, strTitleNo As String
 
Dim dbsTPIETS As DAO.Database
Dim Replace As DAO.Recordset
Dim dbMat As DAO.Database
Dim rstMat As DAO.Recordset
Dim strSQL As String
 
strMsg = "Do you want to add a new recrut....?"
strTitle = " Add OK"
 
If IsNull(Me.Employee_ID) Or Me.Combo1 = "" Then
    MsgBox "Pease Enter the Employee_ID or Replacement", vbOKOnly, "Required Data"
    DoCmd.Close acForm, "frmAddEmp"
Else
 
    Set dbsTPIETS = CurrentDb
    Set Replace = dbsTPIETS.OpenRecordset("tblReplacement", dbOpenDynaset, dbInconsistent)
    Set dbMat = CurrentDb()
    strSQL = "SELECT tblEmployees.Employee_ID, tblEmployees.Replaced FROM tblEmployees WHERE (((tblEmployees.Replaced)= " & "No" & ")) and ((tblEmployees.Employee_ID)= " & TextMat & " );"
    Set rstMat = dbMat.OpenRecordset(strSQL, dbOpenDynaset)
 
    With rstMat
     .Edit
     !Replaced = "Yes"
     .Update
   End With
      
Me.Refresh
 
Replace.AddNew
Replace!Employee_ID = Me!Employee_ID
Replace!strFullName = Me!strFullName
Replace!strAdministration_ID = Me!strAdministration_ID
Replace!strDepartment_ID = Me!strDepartment_ID
Replace!INTITULE = Me!INTITULE
 
Replace.Update
Replace.Close
 
End If
    
If MsgBox(strMsg, vbQuestion + vbYesNo + vbDefaultButton2, strTitle) = vbYes Then
DoCmd.SetWarnings False
  Form.RecordSource = "SELECT tblEmployees.* FROM tblEmployees;"
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
    DoCmd.GoToRecord , , acNewRec
    
Err_BNEW1_Click:
On Error Resume Next
 
    DoCmd.GoToRecord , , acNewRec
    Me.Employee_ID.SetFocus
End If
End Sub
انتظر مساعدتكم

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.

  • تصفح هذا الموضوع مؤخراً   0 اعضاء متواجدين الان

    • لايوجد اعضاء مسجلون يتصفحون هذه الصفحه
×
×
  • اضف...

Important Information