Page 1 of 2 12 LastLast
Results 1 to 15 of 29
  1. #1
    menyarito is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Apr 2017
    Posts
    16

    [RÉSOLU] Hide record after selection

    Hi everyone,

    I have two tables : customers and houses.
    If a customer chooses a house (example: H33), The house (H33) will not appear after
    to avoid two customers choosing the same house.


    http://www.cjoint.com/c/GDwnVJM20M3

    Thanks in advance for your help
    Last edited by menyarito; 04-22-2017 at 11:05 PM.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    THouses should have a [ownerID] field.
    user picks it, that field fills w ownerID,
    the query to pick houses would only show houses where ownerID is null.

  3. #3
    menyarito is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Apr 2017
    Posts
    16
    Thanks ranman256

    I am beginner, could you show me please how i can do

    Thanks in advance for your help

  4. #4
    menyarito is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Apr 2017
    Posts
    16

  5. #5
    menyarito is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Apr 2017
    Posts
    16
    up plz....

  6. #6
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    OK have you added the field yet? As Ranman suggested?

  7. #7
    menyarito is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Apr 2017
    Posts
    16
    Quote Originally Posted by andy49 View Post
    OK have you added the field yet? As Ranman suggested?
    No, How I can do it?
    I want as this: http://www.cjoint.com/c/GDwnVJM20M3

    Thanks for your help

  8. #8
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    click once on the table houses

    Select design view

    Add another field called OWNERID (a number field)

  9. #9
    menyarito is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Apr 2017
    Posts
    16
    Quote Originally Posted by andy49 View Post
    click once on the table houses

    Select design view

    Add another field called OWNERID (a number field)
    ok done...

  10. #10
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    what's the name of the field which has the number 1 in your link

  11. #11
    menyarito is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Apr 2017
    Posts
    16
    Quote Originally Posted by andy49 View Post
    what's the name of the field which has the number 1 in your link
    Customer ID

  12. #12
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    ignore its not right


    Put this in the combo_update() event




    Code:
    Dim sqlstr As String
    Dim db As Database
        Set db = CurrentDb 
       sqlstr = "INSERT INTO Houses " _
            & "(OWNERID) VALUES " _
            & "(" & Chr(34) & customerID & Chr(34) & ");"
            
       
       'db.Execute sqlstr
    I've assumed your table is called Houses
    And the owner field is called OWNERID

  13. #13
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    Put this in the combo_update() event

    Code:
    Dim sqlstr As String
    Dim db As Database
        Set db = CurrentDb
       
      
       sqlstr = "INSERT INTO Houses " _
            & "(OWNERID) VALUES " _
            & "(" & Chr(34) & customerID & Chr(34) & ")" _
            & " where HOUSEID = " & cbochoice.Value & ";"
            
       
       'db.Execute sqlstr
      Debug.Print sqlstr


    This will need a bit of checking before we go further I think.

    It should place my OWNERID in the correct place in the table Houses once I've chosen HouseB

    Can we see the rowsource of the combobox as it will need to be changed slightly

  14. #14
    menyarito is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Apr 2017
    Posts
    16
    Quote Originally Posted by andy49 View Post
    Put this in the combo_update() event

    Code:
    Dim sqlstr As String
    Dim db As Database
        Set db = CurrentDb
       
      
       sqlstr = "INSERT INTO Houses " _
            & "(OWNERID) VALUES " _
            & "(" & Chr(34) & customerID & Chr(34) & ")" _
            & " where HOUSEID = " & cbochoice.Value & ";"
            
       
       'db.Execute sqlstr
      Debug.Print sqlstr


    This will need a bit of checking before we go further I think.

    It should place my OWNERID in the correct place in the table Houses once I've chosen HouseB

    Can we see the rowsource of the combobox as it will need to be changed slightly
    sorry but where is the combo_update() event

  15. #15
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    in Form design view, click on the combobox then on the properties sheet icon and you'll see a small window open which includes the word event

    Click on event and you'll see after update

    press the three dots (...) and select the code builder option

    the code is then pasted

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

Similar Threads

  1. Replies: 2
    Last Post: 11-26-2016, 05:43 PM
  2. Replies: 6
    Last Post: 02-23-2016, 01:45 PM
  3. Replies: 6
    Last Post: 01-15-2014, 02:56 PM
  4. Replies: 6
    Last Post: 02-24-2011, 03:24 PM
  5. Replies: 1
    Last Post: 09-27-2010, 06:58 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