Results 1 to 9 of 9
  1. #1
    carstenhdk is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    May 2010
    Location
    Denmark
    Posts
    42

    Question Add new contacts


    Hi


    A have a database with attendents to 4 weeks courses. When a new team arrives the names are added to the database. It is the same person who add the persons and is the teacher for this particular team. It would nice and timesaving, if he wouldn´t have to choose his own name every time and the starting date for each person. He adds a team at the same time, so his name and the starting date is the same. I think of it as this:

    A dialog box: What date does the team arrive?
    Another: What is your name?
    A form: Add the persons that will is a part of this team

    I have a table with the teachers names. The table with the attendents have a field named "Starting date".



    Thx for the help

  2. #2
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    By reading your thread I assume that you have the following requirements.
    1) The user needs to enter User Name and a specific date to every record that he makes. you want the user to enter the user Name and the date only once and the same should be used in all the netries that the user makes.

    I have attaching a simple mdb file. I have a user Table that I use to populate a Combobox on a Form called Form1 that is my Startup. The user is required to select a user name and type a date. This in turn is used to populate the User and Date Field in another form called Main1.

    Now this has to be done with a certain amout od discretion for the following reasons:
    1) The user name and date of any existing entry should not be changed.
    2) The user must be prompted to either copy or discared user name and date in case the user opens a new entry by accident.

    There are two piece of Code one attached to the Open Form in the Form1 which ensures that a user selects a user name and types a date:

    Private Sub Command9_Click()
    On Error GoTo Err_Command9_Click

    Dim stDocName As String
    Dim stLinkCriteria As String
    If IsNull(Me.Combo5) Then
    MsgBox "Please select a User Name", vbInformation, "No User Name"
    ElseIf IsNull(Me.Text7) Then
    MsgBox "Please type Startdate", vbInformation, "No Date"
    Else
    stDocName = "Main"
    DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormEdit

    End If

    The other code that actually populates the Fields is attached to

    Exit_Command9_Click:
    Exit Sub

    Err_Command9_Click:
    MsgBox Err.Description
    Resume Exit_Command9_Click

    End Sub

    The next code is attached to the OnCurrent event of the Main Form:

    Private Sub Form_Current()
    If IsNull(Me.User) And IsNull(Me.Date) Then
    Dim strMessage As String
    strMessage = MsgBox("Do you want the User Name and Date to be Copied", vbInformation + vbYesNo, "User Name and Date")
    Select Case strMessage
    Case vbYes
    Forms!Main!User = Forms!Form1!Combo5.Column(1)
    Forms!Main!Date = Forms!Form1!Text7
    Case vbNo
    MsgBox "You have canceled action"
    End Select
    End If
    End Sub

    This code populates the two fields. It prompts the user whether to populate the fields Now selecting yes populates the Fields and no dosen't.

    Attaching a sample mdb file for you reference.

  3. #3
    carstenhdk is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    May 2010
    Location
    Denmark
    Posts
    42
    Woow!! Thx alot! This was really a great answer! Thx! :-) I have a question allthough:

    Is it possible to have a form designed only to make the new entries of the students? I want to get rid of the "Do you want to copy teacher and date?" prompt. Then, when more info needs to be added, it is in another form?

    1st form:
    When the students arrive, its their name and contact info which is added.

    2nd form:
    Along time with personal coaching and so on the entries will be updated with these informations.




    Does that make a conflict according to what you adviced me to be aware of?

  4. #4
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    I can get rid of the message but consider this as the code is attached to the oncurrent event of the Form if the user by chance opens a new entry using the navigation button then the user name and the date is copied and unnecessarily a new ntry will be created.

    is it possible to have a form designed only to make the new entries of the students?

    If this is What you Want than make the following changes to the Code.

    Private Sub Form_Current()
    If IsNull(Me.User) And IsNull(Me.Date) Then
    Forms!Main!User = Forms!Form1!Combo5.Column(1)
    Forms!Main!Date = Forms!Form1!Text7
    End If
    End Sub

    and in the form property of the main form allow data entry this will ensure that a new form will open all the time and the userName and date will be copied on to it.

    See if you can make the changes if not I ma there to help.

  5. #5
    carstenhdk is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    May 2010
    Location
    Denmark
    Posts
    42
    Thx for the help.


    Allthough I can see, that the main form doesn´t save the UserName in the new entry. Look at it like this:

    I´m a teacher recieving a new team tomorrow. I got a list with names of the students. I will add their names in a form, where I only have to enter my name and the startdate once. I close the form, and will then later on use another form to add mentoring-data to each student (that´s not relevant in this thread). When I open the first form again, it will prompt me for my name and the startingdate again.

    I´ve got an idea in this work: Is it easy to add a unique Id number (chosen by the database) to each class?

  6. #6
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    This What I have done. You have an entry form. when you open it you will be prompted to type a user name and a date. The form will open. Every time you enter data, and save the record the user name and the date is automatically entered in the form. when you close the form and reopen it again it again prompts for a user name and a date.

    Codee used:
    Option Compare Database
    Dim strUserName As String
    Dim dtStarting As Date



    Private Sub Command8_Click()
    On Error GoTo Err_Command8_Click


    DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
    Me.User = strUserName
    Me.Date = strStarting
    MsgBox dtUserName
    Exit_Command8_Click:
    Exit Sub

    Err_Command8_Click:
    MsgBox Err.Description
    Resume Exit_Command8_Click

    End Sub


    Private Sub Form_Open(Cancel As Integer)
    strUserName = InputBox("Enter User Name")
    strStarting = InputBox("Enter Starting Date")
    End Sub

    I am attaching a sample db for your reference. if this solves your problem mark the thread solved.

  7. #7
    carstenhdk is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    May 2010
    Location
    Denmark
    Posts
    42
    Thx again! You´re really a great help to me! ;-)

  8. #8
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    Tell me about the report.

  9. #9
    carstenhdk is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    May 2010
    Location
    Denmark
    Posts
    42
    Pdf for your information:



    This person has a page to his own. The four weeks is shown by day count at the left and by date next to the day count. A note-feild for additional information. Time of arrival, if the person has phoned to us and informed us. Does it make sense now? ;-)

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

Similar Threads

  1. Link Existing Access Database to Outlook Contacts
    By rdaled in forum Database Design
    Replies: 3
    Last Post: 12-17-2009, 10:21 AM
  2. Contacts Database
    By karthikcoep in forum Access
    Replies: 0
    Last Post: 08-17-2009, 02:02 AM
  3. Outlook contacts
    By noidea in forum Access
    Replies: 0
    Last Post: 07-31-2009, 07:44 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