+ Post New Thread
Results 1 to 6 of 6
Coding Thread, Access Database Issues, data not writing to table in Coding and Web Development; I have a form where I have cascading combo boxes working, however when I move on to my next record ...
  1. #1

    CHR1S's Avatar
    Join Date
    Feb 2006
    Location
    Birmingham
    Posts
    4,505
    Thank Post
    1,585
    Thanked 486 Times in 304 Posts
    Rep Power
    217

    Access Database Issues, data not writing to table

    I have a form where I have cascading combo boxes working, however when I move on to my next record the selected building and room although correct in the boxes does not save into the table.

    Its going to be a stupid error where I have missed something obvious but I cant see the wood for the trees atm!

  2. #2

    Join Date
    May 2008
    Location
    Cheshire
    Posts
    292
    Thank Post
    48
    Thanked 27 Times in 24 Posts
    Rep Power
    18
    Might be easiest if you upload the database, someone or myself might have time to have a quick glance and help resolve it?

  3. Thanks to Pashers from:

    CHR1S (2nd July 2012)

  4. #3

    CHR1S's Avatar
    Join Date
    Feb 2006
    Location
    Birmingham
    Posts
    4,505
    Thank Post
    1,585
    Thanked 486 Times in 304 Posts
    Rep Power
    217
    combotest1.rar

    So basically because I display the Building and Room real names and hide the BuildingID and RoomID I cant bind to them (Assets Form), so I will need some VB code on a save button to write those values to the Asset table in the required fields.

    Does that look whats required?

    Thanks
    Last edited by CHR1S; 2nd July 2012 at 03:09 PM.

  5. #4

    CHR1S's Avatar
    Join Date
    Feb 2006
    Location
    Birmingham
    Posts
    4,505
    Thank Post
    1,585
    Thanked 486 Times in 304 Posts
    Rep Power
    217
    Think I have my head round it now, swapped the bindings to the primary keys, displayed 2 columns bit hid the first column with a 0cm width.

    All working it seems!

  6. #5

    Join Date
    May 2008
    Location
    Cheshire
    Posts
    292
    Thank Post
    48
    Thanked 27 Times in 24 Posts
    Rep Power
    18
    Glad you have it working, if you want the sql something along these lines would be a quick resolution:
    DoCmd.RunSQL "INSERT INTO Assets ( AssetDescription, EmployeeID, StatusID, AssetCategoryID, Room, Building, VendorID, ModelNumber, SerialNumber, BarcodeNumber, DateAcquired, PurchasePrice, Comments, Description, [Date Disposed] ) SELECT '" & AssetDescription & "', " & EmployeeID & ", " & StatusID & ", " & AssetCategoryID & ", '" & Room & "', '" & cboCategories_2 & "', " & VendorID & ", '" & ModelNumber & "', '" & SerialNumber & "', '" & BarcodeNumber & "', '" & DateAcquired & "', '" & PurchasePrice & "', '" & Comments & "', '" & AssetDescription & "', '" & DateSold & "'"

    You'll need to look at the tables again. The IDs in the Assets table should be Integer not text. The only primary key you should need is for the AssetID in that table. The rest are other 'ID' fields are called foreign and should link to a primary key in different tables.

    For example in your Asset table you have EmployeeID. You also have Employee table with a field called EmployeeID. In the Employee table the EmployeeID field should be Primary Key. Not in the Asset table. Then you should link them together.

  7. Thanks to Pashers from:

    CHR1S (2nd July 2012)

  8. #6

    CHR1S's Avatar
    Join Date
    Feb 2006
    Location
    Birmingham
    Posts
    4,505
    Thank Post
    1,585
    Thanked 486 Times in 304 Posts
    Rep Power
    217
    Thanks, tidied my tables and relationships up!

    Just need to implement an audit trail and logon system and I think its ready... ish

SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 0
    Last Post: 29th November 2011, 09:41 AM
  2. Replies: 0
    Last Post: 15th November 2011, 09:19 AM
  3. Scholaris accessing/writing to Sims: Legit?
    By mr_simonward in forum Virtual Learning Platforms
    Replies: 18
    Last Post: 20th November 2009, 11:52 AM
  4. Passing data from dreamweaver to an Access file
    By StewartKnight in forum How do you do....it?
    Replies: 2
    Last Post: 26th January 2007, 11:35 AM
  5. Test Data not sent back to APS - can't do anything!!
    By indiegirl in forum ICT KS3 SATS Tests
    Replies: 10
    Last Post: 18th May 2006, 02:42 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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