Results 1 to 13 of 13
  1. #1
    mwabbe is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    Aug 2010
    Posts
    79

    Staying on Same Record


    Hello, I am trying to make an employee directory database. there a few tables used to enter info about each employee such as general, benefits, emergency contact and so on. i have a button that is for a new employee. it opens the first form, the general form where things like the name and id are typed in. i have a button to save the record and open the next form for input "benefits". is there any way to make it stay on the current record so that the name and id from the first form are the same on the next.

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    What are you doing to make it move off of the current record? Access does not do that on it's own.

  3. #3
    weekend00 is offline I may not be right
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    1,295
    RuralGuy: He opens another form, the new opened form doesn't focus on the new added record.

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    OK then, here's my preference: http://www.baldyweb.com/OpenArgs.htm
    Paul put that together at my prompting since I'm too lazy.

  5. #5
    mwabbe is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    Aug 2010
    Posts
    79
    i am getting a type mismatch error. god is it annoying

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Are you trying to match up a String or a Number?

  7. #7
    mwabbe is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    Aug 2010
    Posts
    79
    trying to match up number-number, text-text, text-text

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Did you use the OpenArgs approach? If so, lets see your OnLoad code from start to finish.

  9. #9
    mwabbe is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    Aug 2010
    Posts
    79
    Private Sub Form_Load()

    Dim strOpenArgs() As String
    If Not IsNull(Me.OpenArgs) Then
    strOpenArgs = Split(Me.OpenArgs, ";")
    Me.EmployeeID = strOpenArgs(0)
    Me.Text44 = strOpenArgs(1)
    Me.Text46 = strOpenArgs(2)
    End If
    End Sub

  10. #10
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Try This code:
    Code:
    Private Sub Form_Load()
       Dim strOpenArgs() As String
       
       If Not IsNull(Me.OpenArgs) Then
          strOpenArgs = Split(Me.OpenArgs, ";")
          Me.EmployeeID = strOpenArgs(0)         '-- A Number
          Me.Text44 = "'" & strOpenArgs(1) & "'" '-- A String
          Me.Text46 = "'" & strOpenArgs(2) & "'" '-- Another string
       End If
        
    End Sub
    BTW...I used code tags , the # in the advanced toolbar.

  11. #11
    mwabbe is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    Aug 2010
    Posts
    79
    thank you, i changed that i keep getting the same error and when i hit debug this line comes up. its the line that i use on the button to go from one form to the next.

    DoCmd.OpenForm "Benefits", acNormal, "", "", "", acDialog, Me.Text59 & ";" & Me.First_Name & ";" & Me.Last_Name

  12. #12
    mwabbe is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    Aug 2010
    Posts
    79
    Took the qoutes out of those empty arguments. works now. thanks for the help rural guy

  13. #13
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Excellent and you are very welcome.

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

Similar Threads

  1. Replies: 5
    Last Post: 06-29-2010, 01:24 PM
  2. If duplicate record, go to original record
    By islandboy in forum Access
    Replies: 51
    Last Post: 06-02-2010, 04:17 PM
  3. copy current record to new record
    By er_manojbisht in forum Forms
    Replies: 1
    Last Post: 02-27-2010, 05:31 PM
  4. Replies: 3
    Last Post: 06-27-2009, 03:53 PM
  5. Deleting Record Contents, not complete record...
    By Charles Waters in forum Access
    Replies: 2
    Last Post: 06-24-2008, 12:00 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