|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Object variable or with block variable not set
does anyone have any idea why i get this error?
object variable or with block variable not set code below: Dim m_RecSet As Object Dim intInitH As Integer Event BtnClick(Index As Integer) Private Sub txtCriteriu_KeyPress(KeyAscii As Integer) Static strCrit As String, gasit1 As Boolean With RecSet If KeyAscii = 13 Then ' Height = intInitH Select Case .Fields(lstCampuri.ListIndex).Type Case dbLongBinary, dbMemo, dbTimeStamp, dbVarBinary strCrit = "" Case dbText strCrit = "UCase(" & Trim(lstCampuri.List(lstCampuri.ListIndex)) & ") " & cboOperator.Text & "'*" & UCase(Trim(txtCriteriu.Text)) & "*'" Case dbDate If cboOperator.Text <> "LIKE" Then strCrit = Trim(lstCampuri.List(lstCampuri.ListIndex)) & " " & cboOperator.Text & "#" & Format(Trim(txtCriteriu.Text), "mm/dd/yyyy") & "#" Else MsgBox "Nu puteti folosi operatorul LIKE " & "pentru date calendaristice" strCrit = "" Exit Sub End If Case Else If cboOperator.Text <> "LIKE" Then strCrit = Trim(lstCampuri.List(lstCampuri.ListIndex)) & " " & cboOperator.Text & Val(Trim(txtCriteriu.Text)) Else MsgBox "Nu puteti folosi operatorul LIKE pentru date de tip numeric" strCrit = "" Exit Sub End If End Select .MoveFirst Select Case gasit1 Case False .FindFirst strCrit Case True .FindNext strCrit End Select If .NoMatch Then MsgBox "Nu gasesc nimik dupa criteriul " & strCrit gasit1 = False Else gasit1 = True End If End If End With End Sub Private Sub UserControl_Initialize() intInitH = cmdNavigare(0).Height End Sub Private Sub cmdNavigare_click(Index As Integer) Static blnAd As Boolean, blnMd As Boolean, oImgVeche As Object With RecSet Select Case Index Case 0 cboOperator.Visible = False cboOperator.Clear .MoveFirst Case 1 cboOperator.Visible = False cboOperator.Clear If Not .BOF() Then .MovePrevious If .BOF() Then .MoveLast Case 2 cboOperator.AddItem "LIKE" cboOperator.AddItem "=" cboOperator.Visible = True lblCriteriu.Visible = True lstCampuri.Visible = True txtCriteriu.Visible = True lblDupa.Visible = True 'Height = intInitSize + lstCampuri.Height + 600 lstCampuri.Clear 'cboOperator.ListIndex = 0 For i = 0 To .Fields.Count - 1 Select Case .Fields(i).Type Case dbLongBinary, dbBinary, dbCurrency, dbGUID, dbMemo, dbTimeStamp, dbVarBinary Case Else lstCampuri.AddItem .Fields(i).Name End Select Next i If lstCampuri.ListCount <> 0 Then lstCampuri.ListIndex = 0 ' cboOperator.Clear Case 3 cboOperator.Clear cboOperator.Visible = False lblCriteriu.Visible = False lstCampuri.Visible = False txtCriteriu.Visible = False lblDupa.Visible = False If Not .EOF() Then .MoveNext If .EOF() Then .MoveFirst Case 4 cboOperator.Visible = False cboOperator.Clear lblCriteriu.Visible = False lstCampuri.Visible = False txtCriteriu.Visible = False lblDupa.Visible = False .MoveLast Case 5 cboOperator.Visible = False cboOperator.Clear lblCriteriu.Visible = False lstCampuri.Visible = False txtCriteriu.Visible = False lblDupa.Visible = False If Not blnMd Then .Edit ActivareButoane False, Index Set oImgVeche = cmdNavigare(Index).Picture cmdNavigare(Index).Picture = LoadPicture("") cmdNavigare(Index).Caption = "&Comite" blnMd = True Else .Update ActivareButoane True, Index Set cmdNavigare(Index).Picture = oImgVeche cmdNavigare(Index).Caption = "" blnMd = False End If Case 6 cboOperator.Visible = False cboOperator.Clear lblCriteriu.Visible = False lstCampuri.Visible = False txtCriteriu.Visible = False lblDupa.Visible = False If .BOF() Or .EOF() Then MsgBox "Nu exista nimc de sters!", vbExclamation, "Stergere..." Else On Error GoTo erori If vbYes = MsgBox("Sunteti sigur(a)?", vbYesNo + vbQuestion, "Stergere...") Then .Delete If Not .EOF() Then .MoveNext ElseIf Not .BOF() Then .MovePrevious End If End If End If Case 7 cboOperator.Visible = False cboOperator.Clear lblCriteriu.Visible = False lstCampuri.Visible = False txtCriteriu.Visible = False lblDupa.Visible = False If .EditMode <> dbEditNone Then ActivareButoane True, Index Select Case .EditMode Case dbEditInProgress cmdNavigare(5).Caption = "" cmdNavigare(5).Picture = LoadPicture(App.Path & "\graphics\edit.bmp") ' Case dbEditAdd ' cmdNavigare(5).Caption = "" ' cmdNavigare(5).Picture = LoadPicture(App.Path & "\graphics\add.bmp") End Select .CancelUpdate blnAd = False blnMd = False Else MsgBox "Nu exista nimik de anulat", vbExclamation, "Anulare operatie..." End If End Select End With RaiseEvent BtnClick(Index) Exit Sub erori: TratErori Err.Number, Err.Description, Err.Source End Sub Sub ActivareButoane(blnStare As Boolean, k As Integer) For i = 0 To cmdNavigare.Count - 2 If k <> i Then cmdNavigare(i).Enabled = blnStare End If Next i End Sub ' proprietati generate de wizard: 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMENTED LINES! 'member info=9,0,0,0 Public Property Get RecSet() As Object Set RecSet = m_RecSet End Property Public Property Set RecSet(ByVal New_RecSet As Object) Set m_RecSet = New_RecSet PropertyChanged "RecSet" End Property Private Sub UserControl_ReadProperties(PropBag As PropertyBag) Set m_RecSet = PropBag.ReadProperty("RecSet", Nothing) UserControl.Enabled = PropBag.ReadProperty("enabled", True) End Sub Private Sub UserControl_WriteProperties(PropBag As PropertyBag) Call PropBag.WriteProperty("RecSet", m_RecSet, Nothing) Call PropBag.WriteProperty("enabled", UserControl.Enabled, True) End Sub |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Database Development > Object variable or with block variable not set |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|