Hello,
The following piece of code I am having an error in. I divided it to two parts to simplify it.
This part is fine. But I get the error in his part of code:VB Code:
Dim sConnString As String Dim rsTempRecordSet As New ADODB.Recordset Dim cnTeamCMI As New ADODB.Connection Dim sSQl As String strConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\ÅÓáÇã\ÓØÍ ÇáãßÊÈ\ÈÑäÇãÌ ÇáÍÖæÑ æ ÇáÇäÕÑÇÝ\database.mdb;Jet OLEDB:Engine Type=5;" With cnTeamCMI .ConnectionString = sConnString .ConnectionTimeout = 0 .CursorLocation = adUseClient .Open strConnString End With sSQl = "SELECT [ÑÕíÏ ÇáÅÌÇÒÇÊ] FROM [ÇáÅÏÇÑí] WHERE [ÇÓã ÇáÚÇãá] = '" & lstMngment.List(lstMngment.ListIndex) & "'" rsTempRecordSet.Open sSQl, cnTeamCMI, adOpenStatic, adLockReadOnly With rsTempRecordSet If .Fields("ÑÕíÏ ÇáÅÌÇÒÇÊ") >= 1 Then cmdMGTHoliday.Enabled = True Else cmdMGTHoliday.Enabled = False End If End With rsTempRecordSet.Close Set rsTempRecordSet = Nothing Set cnTeamCMI = Nothing
It highlights this line: " If .Fields("ÍÖæÑ") = "ÅÌÇÒÉ" Then" with an error message telling me that either BOF or EIF is True, or the current record has been deleted, the process needs a current record. (The error message is in Arabic I tried to translate as accurate as I could). Any suggestions on how to solve this problem?VB Code:
With cnTeamCMI .ConnectionString = sConnString .ConnectionTimeout = 0 .CursorLocation = adUseClient .Open strConnString End With sSQl = "SELECT [ÍÖæÑ] FROM [ÊæÞíÊÇÊ ÇáÅÏÇÑí] WHERE [ÇÓã ÇáÚÇãá] = '" & lstMngment.List(lstMngment.ListIndex) & "' AND [ÊÇÑíÎ ÇáÏÎæá] = #" & Format(Now, "dd/mm/yy") & "#" rsTempRecordSet.Open sSQl, cnTeamCMI, adOpenStatic, adLockReadOnly With rsTempRecordSet If .Fields("ÍÖæÑ") = "ÅÌÇÒÉ" Then cmdMGTHoliday.Enabled = False Else cmdMGTHoliday.Enabled = True End If End With rsTempRecordSet.Close End Sub
Thanx in advance!




!
Reply With Quote