Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    newegyptian is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Mar 2019
    Posts
    46

    i want to add data from pop up form

    I have customer table contain ID , NAME , AGE



    Click image for larger version. 

Name:	1.jpg 
Views:	27 
Size:	153.2 KB 
ID:	37818


    I have phone table contain ID , TYPE , NUMBER

    Click image for larger version. 

Name:	2.jpg 
Views:	26 
Size:	155.2 KB 
ID:	37819

    I made one to many relation between two table ID , ID


    Click image for larger version. 

Name:	3.jpg 
Views:	27 
Size:	75.4 KB 
ID:	37820
    I made customer form

    Click image for larger version. 

Name:	5.jpg 
Views:	26 
Size:	86.9 KB 
ID:	37821
    I made phone form pop up type
    Click image for larger version. 

Name:	4.jpg 
Views:	26 
Size:	113.5 KB 
ID:	37822

    I made button in customer form to open phone form specific to customer form



    but when I open button , it didn't set ID as default so I cant add numbers to the specified customer



    how I can solve it

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,924
    Recommend using form/subform arrangement. Otherwise, need tricky code passing data between forms and there is more than one way to do it.
    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
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Also be aware that "name", "Type" and "number" are reserved words and shouldn't be used for object names.



    Please stick with one thread until your problem is solved. Otherwise people will get tired of trying to follow multiple threads and ignore your questions..... just saying..........



    BTW, welcome to the forum......

  4. #4
    phivosz is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2014
    Posts
    17
    Add this to the On Open event of phoneform: Me.ID=Forms!customerform!ID That should do it

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,924
    If the form opens to existing record, that code will replace value. As I said, gets tricky to pass data between forms. A form/subform arrangement handles this for you.
    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.

  6. #6
    newegyptian is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Mar 2019
    Posts
    46
    how i can use these ways

  7. #7
    newegyptian is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Mar 2019
    Posts
    46
    Quote Originally Posted by ssanfu View Post
    Also be aware that "name", "Type" and "number" are reserved words and shouldn't be used for object names.



    Please stick with one thread until your problem is solved. Otherwise people will get tired of trying to follow multiple threads and ignore your questions..... just saying..........



    BTW, welcome to the forum......

    thanks

    happy to be in this form

  8. #8
    newegyptian is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Mar 2019
    Posts
    46
    Quote Originally Posted by phivosz View Post
    Add this to the On Open event of phoneform: Me.ID=Forms!customerform!ID That should do it
    please write all code which i should write in it


    Private Sub Command17_Click()
    End Sub


    i am new to access

  9. #9
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,924
    Okay, if you really want to go down this path, try:

    If Me.NewRecord Then Me.ID=Forms!customerform!ID
    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.

  10. #10
    newegyptian is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Mar 2019
    Posts
    46
    Quote Originally Posted by June7 View Post
    Okay, if you really want to go down this path, try:

    If Me.NewRecord Then Me.ID=Forms!customerform!ID



    i made this but not work

  11. #11
    newegyptian is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Mar 2019
    Posts
    46



    also this not work

  12. #12
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,800
    Looks to me like you put it in the wrong form. You're showing a button click event, which is on the first form, yes? You're setting the id value to be what it already is on that form IF the statement would evaluate to TRUE which it won't because it's not a new record on the first form.
    Move the code to the opening form as was stated in post 4. If I'm wrong about where the code is, my apologies.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  13. #13
    newegyptian is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Mar 2019
    Posts
    46
    Quote Originally Posted by Micron View Post
    Looks to me like you put it in the wrong form. You're showing a button click event, which is on the first form, yes? You're setting the id value to be what it already is on that form IF the statement would evaluate to TRUE which it won't because it's not a new record on the first form.
    Move the code to the opening form as was stated in post 4. If I'm wrong about where the code is, my apologies.






    i made that .. did i miss thing ??

  14. #14
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,924
    I tested Open event and it would not work. Use Load or Current event.

    But if ID is an autonumber field in this table, cannot set its value. Is ID a number type field that is for the customer ID foreign key? Should give fields better names. Avoid using exactly the same name in multiple tables.
    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.

  15. #15
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,800
    According to 2nd and 3rd images it is not autonumber.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 7
    Last Post: 07-24-2017, 11:47 PM
  2. Replies: 6
    Last Post: 04-04-2015, 08:10 AM
  3. Replies: 3
    Last Post: 03-19-2015, 02:11 PM
  4. Replies: 4
    Last Post: 02-14-2014, 11:09 AM
  5. Replies: 1
    Last Post: 12-21-2011, 02:11 PM

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