Results 1 to 9 of 9
  1. #1
    armyofdux is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Nov 2014
    Posts
    55

    What type of box to use

    Hello everyone,



    Trying to make/design a form for adding a persons Social Security Number. I have existing data within my database as a table. I can get everything to work properly with a form for adding new data except for this particular field. The data and where it originates from constantly changes but it does not drop off existing data. I guess the problem is that I obviously cannot have a duplicate entry.

    So I want to be able to have my data entry persons add the students via this form but like I said I cant have duplicate entries. Ideally I want to have the SSN field at the top so that when a new record is about to be entered and the ssn is already in the database that it pulls up the record already in existence? Someone point me in the right direction?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,954
    Options:

    1. UNBOUND combobox to enter/select SSN, if SSN is already in list then filter form to that record, if not in list then go to new record row - code can populate the SSN field with combobox value

    2. BOUND textbox to enter SSN, code in BeforeUpdate event looks for existing record and if found, cancels input and filters (or go to) that record
    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
    Missinglinq's Avatar
    Missinglinq is online now VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    As usual, there are almost always multiple ways to accomplish a task in Access. In addition to June7's suggestion, you could use something like this:

    Code:
    Private Sub SSN_AfterUpdate()
    
        Dim rs As Object
    
        Set rs = Me.Recordset.Clone
        rs.FindFirst "[SSN] = '" & Me![SSN] & "'"
        If rs.NoMatch Then
         'Do Nothing Continue entering New Record
        Else
         Me.Undo
         If Not rs.EOF Then Me.Bookmark = rs.Bookmark
        End If
    
    End Sub

    This assumes that your Social Security Number field is defined as Text, which it usually is, and you'll need to substitute your actual name for SSN in the code, above.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  4. #4
    armyofdux is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Nov 2014
    Posts
    55
    Thanks guys, it gave me some ideas and I like all of them. I can't figure out how to implement it. Could I sanitize the SSNs and upload it here? I like learning just need someone to show me how. Any and all help would be appreciated.

  5. #5
    Missinglinq's Avatar
    Missinglinq is online now VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Quote Originally Posted by armyofdux View Post

    ...Could I sanitize the SSNs and upload it here...
    Sure!

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  6. #6
    armyofdux is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Nov 2014
    Posts
    55
    Attachment 19476 Here it is. The end state of this one is to assign a class to a respective student as well as a room assignment. I have gotten pretty far (at least I think so) in the creation of this without having been in Access as much as I need to be.
    Last edited by armyofdux; 01-28-2015 at 08:57 AM.

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,954
    I tried opening the db and get error 'unrecognized format'.
    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.

  8. #8
    armyofdux is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Nov 2014
    Posts
    55
    DBHOME.Zip Try again
    Last edited by armyofdux; 01-28-2015 at 08:57 AM.

  9. #9
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,954
    HUB Table has all 10 fields set as compound primary key. Could just define them as a compound index.

    Advise no spaces or special characters/punctuation (underscore is exception) in naming convention. Better would be RoomNum or Room_Num.

    Can a soldier have more than 1 MOS? Certainly can't have more than one GENDER. So why is GENDER in HUB Table? This belongs in Student Data. Why is booking info (room #, arrival date) in Student Data?

    Can a soldier attend more than 1 class?

    Do you want to keep history of soldier course attendance and bookings? If so, this info does not belong in Student Data. Student Data should have info about the individual that is not likely to change or can change but don't care about history of that data element (Last, First, Middle, Gender, DOB, Phone, Address, Rank, Grade, DateOfRank, etc).

    Should Registar be spelled Registrar?
    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. Field Type of type-Double/Float
    By McArthurGDM in forum Access
    Replies: 3
    Last Post: 12-10-2014, 01:54 PM
  2. Replies: 14
    Last Post: 05-08-2014, 12:51 PM
  3. Replies: 3
    Last Post: 05-31-2013, 04:32 PM
  4. How do I fix the #type!
    By Shortone in forum Access
    Replies: 3
    Last Post: 12-02-2010, 11:34 PM
  5. Replies: 2
    Last Post: 03-18-2010, 08:24 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