Results 1 to 14 of 14
  1. #1
    kapil0712 is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2009
    Posts
    8

    Allowing only one selection in YES/NO data field

    Hello,


    I have a table with two columns. One is "Name" (Text data field) and other is "Flag" (YES/NO data field).
    I have created a form where I have pulled in the whole table. So it looks somewhat like this:
    Name Flag
    John Checked
    Tom Unchecked
    Bom Unchecked View Report (command button to view selected name)
    Sam Unchecked
    Dom Checked


    Now my problem is, I just need to allow the user to select only one name at a time when he hits the View Report button.Or else it should give an error that multiple entries have been selected.
    I have surfed the net for a solution. I found one where they suggest to use a record button instead of YES/NO. But since my form is based on a table itself, I am not able to create a field with that data type.
    What should I do? I am worst at coding. Kindly suggest a way out.
    Any help is appreciated.
    Thanks
    Kapil

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows XP Access 2002
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Is your form in Continuous Form mode?

  3. #3
    kapil0712 is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2009
    Posts
    8
    I dont know what you mean by Continuous form? In short, I have opened the table in form mode. So any change I made in form will actually mean that I am updating the table. The only reason I am using a form is that, I wanted to add the custom button (View Report)
    Thanks
    Kapil

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows XP Access 2002
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Can you see more than one record at a time on your form? What section of the form has the Report command button?

  5. #5
    kapil0712 is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2009
    Posts
    8

    Attached sample form

    This is what my form looks like. Again, it is nothing but my table with an additional command button

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows XP Access 2002
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I'm not sure how you achieved that form but I believe you will find only the highlighted record on the left is the Current Record so picking up information from that single record is a snap.

  7. #7
    kapil0712 is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2009
    Posts
    8
    I created a blank access form in access 2007. Pulled the table and placed it in the form. It did its trick...
    I am not getting what you are saying. May be I am not an expert at access.
    But I am stuck at not allowing multiple checks before I am ready to view my report.
    Let me be very clear:

    My report is based on each name, lets say. So when I am checking a name, lets say "Sam", then the report will pull all the data for "Sam".
    However, once Sam is selected, I don't want the user to select one more name. Lets say, he does select one more name (since I have YES/NO data type, it allows multiple selection, but when he goes to print the report, it should give an error saying that, You have selected more than one name.

    Thanks
    Kapil

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows XP Access 2002
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    So the check box is simply to specify a single record for a report? If so, you don't need a check box. What does the code (macro) behind the command button look like?

  9. #9
    kapil0712 is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2009
    Posts
    8
    Yes. Check box is to specify single location. Then how do you suggest to select one record?
    The command button is simply what access under controls, (Using Command button wizard, Under report operations, View Report)
    Please give a solution.

  10. #10
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows XP Access 2002
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    It would be a lot easier if you would just post your db and I'll fix it for you and post it back.

  11. #11
    kapil0712 is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2009
    Posts
    8
    My database. Sorry cant update it with data. Its confidential
    Thanks

  12. #12
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows XP Access 2002
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    There is no code or macro behind the Preview Report button but it shows the left side of your form as a SubForm of a table in Datasheet mode. I created a separate SubForm so I could reference it from the MainForm. Give this a try.

  13. #13
    kapil0712 is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2009
    Posts
    8
    Thanks...Is there any other solution...with a check uncheck or radio buttons?

  14. #14
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows XP Access 2002
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Is the method I used not acceptable?

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

Similar Threads

  1. Data won't show up in table field
    By texzen123 in forum Forms
    Replies: 3
    Last Post: 11-26-2009, 11:20 AM
  2. Data selection
    By cesander in forum Forms
    Replies: 0
    Last Post: 09-18-2008, 02:24 PM
  3. Replies: 0
    Last Post: 04-17-2008, 09:24 AM
  4. Replies: 1
    Last Post: 03-02-2006, 06:17 AM
  5. Field gets data from Expression?
    By Willot in forum Access
    Replies: 3
    Last Post: 12-10-2005, 06:28 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