Results 1 to 5 of 5
  1. #1
    Willie is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2015
    Posts
    3

    Angry MS access issue

    I Have a main form called table one has 3 fields an autonumber as primary key and i have a subform called table 2 has 3 fields one an autonumber a primary key , second is an integer which is equal to table 1 primary key, and third is a text with default value set to N/A

    i want when the user enter info in the main form and save it, the subform automatially add new record and save it with default settings

    so far what s happening , that the related field in the subform to the main, is getting change but record is not getting save in the table 2



    Click image for larger version. 

Name:	Apr 13, 2015 01-27-44 PM.png 
Views:	10 
Size:	14.2 KB 
ID:	20337
    plz assist

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,638
    Never tried or seen anything like this.

    You want this to happen only when new record on main form? Why is middlename in a different table?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Willie is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2015
    Posts
    3
    is there a way around it?, to make it work,

  4. #4
    Willie is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2015
    Posts
    3

    it was a test only

    i was doing a test only for another project shown in the picture, where I have a main form and a tabcontrol for subforms and the data are optional, however i still want the record to be saved by default in case the user didn't enter any, for Report purpose
    Click image for larger version. 

Name:	Apr 13, 2015 01-44-07 PM.png 
Views:	10 
Size:	31.0 KB 
ID:	20339

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,638
    Record is not initiated until user does data entry. Default values do not initiate a record. So cannot check if record is Dirty because there is no data entry.

    Maybe:

    If Me.NewRecord Then
    CurrentDb.Execute "INSERT INTO table2(tblID, middlename) VALUES(" & Me.ID & ", 'N/A')"
    Me.subformcontainer.Requery
    End If

    The real trick is figuring out what event to put code into. Maybe the AfterUpdate event of main form.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 09-03-2014, 09:43 PM
  2. Replies: 4
    Last Post: 10-02-2012, 12:30 AM
  3. Please help with Access issue
    By Acc4me in forum Access
    Replies: 3
    Last Post: 09-25-2011, 12:33 PM
  4. Keep together issue (Access 12)
    By alpha in forum Reports
    Replies: 2
    Last Post: 06-02-2009, 08:21 AM
  5. Access Issue
    By uk in forum Access
    Replies: 0
    Last Post: 07-04-2007, 09:08 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums