Results 1 to 8 of 8

Thread: Crucial question about TABLE ?

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 1999
    Posts
    50

    Post

    Hi guys,

    I've got a very important question for me, I wrote a program in VB4 which deals with two tables in a database, this program at some point displays a form which asks the user to specify the records to be deleted (or modified) in the first table, the second form WHICH COMES AFTER displaying the first one however asks the user to specify the fields to be deleted (or modified (just the field name is modified)).
    The problem is I get a "Could not lock table; currently in use" error every time I press OK in the second form. If I start the second form firstly then it goes fine!!
    I thought that there was a variable that'd been still assigned to the table and that's why database engine could not do anything with the table before removing all variable referencing to that table, BUT I DID THIS and nothing happened, now my question would be something else: I use "Set Tbl = Nothing" statement to deallocate "Tbl" variable, is this enough for the database engine to consider that there's no longer any variable referring to "Tbl" object ?????????

    Can I have assistance from you guys ??

    I highly appreciate your participation.

    poor Wesam !!


    ------------------

  2. #2
    Lively Member
    Join Date
    Jan 1999
    Location
    Gloucester, UK
    Posts
    78

    Post

    You haven't got a grid control, or other data aware control linked to the table in question have you? Could be the control has a recordset open, locking the table.....

    Stab in the dark and all that....

  3. #3

    Thread Starter
    Member
    Join Date
    Feb 1999
    Posts
    50

    Post

    No .. at all, I process this database manually, i.e. through references to DATABASE object, for example:

    Dim DB As Database

    I couldn't figure out why this message box is always appearing ??

    Do you have any suggestions ??

    Wesam

    ------------------

  4. #4
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105

    Post

    Post some code and we'll have a look.

  5. #5

    Thread Starter
    Member
    Join Date
    Feb 1999
    Posts
    50

    Post

    Hi,

    Unfortunately, it isn't that easy to paste the code here becuase it's a little bit complicated and you won't be able to understand how everything is going, instead give your E-mail address and I'll send you the program source code, and I can show how to produce the error and where it comes up.

    Waiting for your reply,

    Wesam.

    ------------------

  6. #6
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105

    Post

    Click on the envelope icon, or check my settings. I've put my address up. I am in class this week so it may be a bit before I get back.

  7. #7
    Lively Member
    Join Date
    Jul 1999
    Posts
    78

    Post

    I've had this problem as well....

    what I think is happening is that the first form is using the table as a recordset, and this locks the database.

    In order to perform any manipulations on the table, the first form must be closed. Normally I have a second form pop up, repeating the information that they selected on the first form (through use of variables) and give the user a second chance to look through and verify the information.

    Second form on load closes the first form, and populates the fields to change etc. through variables, not the table. Then when you press OK, it should work.
    *****************************
    For reference, when I state first form, I mean the one that is causing the locking error. From the sound of it, this is YOUR first form as well.


    [This message has been edited by JohnAtWork (edited 09-03-1999).]

  8. #8

    Thread Starter
    Member
    Join Date
    Feb 1999
    Posts
    50

    Post

    Thank you, it was the problem .. I could figure out the cause.

    Thank you guys for your help.

    Happy Wesam !!

    ------------------

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width