Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2004
    Location
    Barbados
    Posts
    50

    Unanswered: Subform not storing data

    Hey all...

    I have this parent form which holds visitor information for people borrowing books from a library. In the parent form, it has the contact information and a command button, which opens as a subform and displays, or should display the previous books loaned, and the user should be able to add other books to this form.

    Before I already entered test data through the tables and the subform was displaying the data fine. Now I have added a new record to the visitors form and when i click on the book loans button to go to the subform it opens fine. I input the data and click my save button and close the form. Then when i go back to check it.. it's not in the subform...
    but when i open the subform separately, the data is there.

    Any clue on this problem?

    bajan_elf
    "The extreme always make an impression." - Jeff Hardy

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Sounds like a problem with the relationship between the subform and the parent form. Have you double checked to make sure you're using the right key fields?

  3. #3
    Join Date
    Feb 2004
    Location
    Barbados
    Posts
    50

    Indexed field cannot be null.

    OK, so I checked the relationships, and modified the primary keys in the tables. I checked the forms and sure enough the data is displaying for the record.

    But I now have another problem and I see where it is. I have one primary key in the main form 'UserID'. In the subform I have the fields 'UserID' and 'BDS#' (similar to the ISBN#) as, I guess, key fields. The thing is in the subform when I try to save a new record it prompts an error msg saying that the Index field cannot be null. I assume it is referring to the 'UserID' field.

    I have the 'UserID' field in the table for the subform so it can identify which user (visitor) is borrowing the books. Any help on that one?


    bajan elf
    "The extreme always make an impression." - Jeff Hardy

  4. #4
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    It will only error on the UserID if you have referential integrity enforced between the two tables.

    The first thing I would do is remove the "#" from the key field on your subform. # is a reserved character for formating text (most notably dates). Try it with just BDS. Also, are you sure that all the fields are being properly populated? You may not be providing a value for BDS.

    Let me know what you come up with.

  5. #5
    Join Date
    Feb 2004
    Location
    Barbados
    Posts
    50
    Ok I have changed all fields with the '#' sign in it. I then redid the relationships with the tables. The tables are populated properly, but I am still getting the same error.

    You mentioned something about the referential integrity in the relationship between the 'UserID' in the both tables. Won't this cause problems if I take it off?


    bajan_elf
    "The extreme always make an impression." - Jeff Hardy

Posting Permissions

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