Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

database problem.



Can someone please hellp me from losing my hair (being torn out)

I have VB6 Enterprise edition, Access 2000 running on Win XP.

I have linked the database to the VB6 program, and it runs smoothly apart from this one problem (until the next one).

When I run it, the program will go forward and back and even allow me to add new record. BUT it commits hari kari when I try to delete a record. It always has this error

Runtime error: '-2147467259*80004005)':

Query is too complex.
---------------------------------------------------------------------
The code is thus:

Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Index
Case 2
MsgBox "This is for the open"
Case 3
MsgBox "save"
Case 4
ExitProg
Case 5
MsgBox "This is for the print"
Case 7
' This Button takes you to the first record in the database
If Not AdodcUkMatch.Recordset.BOF Then
AdodcUkMatch.Recordset.MoveFirst
If AdodcUkMatch.Recordset.BOF Then
AdodcUkMatch.Recordset.MoveNext
End If
End If
Case 8
' This Button takes you to the previous record in the database
If Not AdodcUkMatch.Recordset.BOF Then
AdodcUkMatch.Recordset.MovePrevious
If AdodcUkMatch.Recordset.BOF Then
AdodcUkMatch.Recordset.MoveNext
End If
End If
Case 9
' This Button takes you to the next record in the database
If Not AdodcUkMatch.Recordset.EOF Then
AdodcUkMatch.Recordset.MoveNext
If AdodcUkMatch.Recordset.EOF Then
AdodcUkMatch.Recordset.MovePrevious
End If
End If
Case 10
' This Button takes you to the last record in the database
If Not AdodcUkMatch.Recordset.EOF Then
AdodcUkMatch.Recordset.MoveLast
If AdodcUkMatch.Recordset.EOF Then
AdodcUkMatch.Recordset.MovePrevious
End If
End If
Case 12
' This Button adds a record to the database
'MsgBox "add rec"
AdodcUkMatch.Recordset.AddNew
Case 13
' This Button refreshes the database
MsgBox "SAVE the database"
AdodcUkMatch.Recordset.Update
Case 14
MsgBox "refresh"
AdodcUkMatch.Refresh
Case 15
'*********** HERE BE THE TROUBLE ************
Confirm = MsgBox("Are you sure you want to delete this record?", vbYesNo, "Deletion Confirmation")
If Confirm = vbYes Then
AdodcUkMatch.Recordset.Delete
MsgBox "Record Deleted!", , "Message"
Else
MsgBox "Record Not Deleted!", , "Message"
End If
Case 18
MsgBox "email"
Case 19
MsgBox "internet"
Case 21
MsgBox "help files"
End Select
End Sub

------------------------------------------------------------------
I've got a few good answers on here before from some great people ... so please help before the wife leaves me through baldness !

Cheers,
Lensmeister.

Comments

  • ganesh4uganesh4u Member Posts: 68
    hi,
    try this

    just change your delete code to

    adoukmatch.recordset.delete adaffectcurrent

    (press space bar after delete you will see options)





    regards,
    Ganesh :)

  • LensmeisterLensmeister Member Posts: 48
    : hi,
    : try this
    :
    : just change your delete code to
    :
    : adoukmatch.recordset.delete adaffectcurrent
    :
    : (press space bar after delete you will see options)
    :
    :
    :
    :
    :
    : regards,
    : Ganesh :)
    :
    :
    Thanks ..... I tried it but it still comes up with the "query too complex" runtime error.

    The database has 200 records in it but there are many fields over 60 fields per record. (60 columns in the table, it may get bigger if others add to the database in the future, maybe up to 1000 records.

    Any other ideas?

    down to my last 5000 hairs !





  • ganesh4uganesh4u Member Posts: 68
    Hi,

    It doesn't matter how many fields or records you have in your database as long as it satisfy access's limits.
    Make your delete button disable when you click it and confirm deletion.
    Explain me a way by which you try to delete your record like you move to perticular record and delete it or other ways.



    regards,


    Ganesh :)

Sign In or Register to comment.