Input Issue In Forms

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • j0rdanf1
    New Member
    • Oct 2006
    • 35

    Input Issue In Forms

    Hello,

    Ok i have a very annoying problem here and as im new to access it is driving me insane.

    Ok what i have is a form which i can enter a new user, which works fine however, if the user already exists in the table to which the form is linked to then i cant bring up that record, due to the form is designed for new users. How can i combine it so i can either enter a new user or do a lookup for an existing user in the same label?

    This is a pic of the relationships i have, i think if this was altered it may work better but i am a newby so this is my best attempt.

  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32636

    #2
    I can only outline as that's as far as my experience with forms takes me.
    You need to build a recordset which is a DynaSet.
    The form built on this recordset should give you the ability to edit OR insert records.
    Test the recordset first. If it shows as having an empty record at the end - it should be an updatable DynaSet.

    Comment

    • j0rdanf1
      New Member
      • Oct 2006
      • 35

      #3
      Originally posted by NeoPa
      I can only outline as that's as far as my experience with forms takes me.
      You need to build a recordset which is a DynaSet.
      The form built on this recordset should give you the ability to edit OR insert records.
      Test the recordset first. If it shows as having an empty record at the end - it should be an updatable DynaSet.
      Never heard of that before, how would i go about doing that?

      Comment

      • MSeda
        Recognized Expert New Member
        • Sep 2006
        • 159

        #4
        You can toggle from Data Entry to Search and Edit by adding a combo box and two comand buttons.

        use the wizard to create the combo box and tell the wizard you want it to find a specific record on your form.
        once the combo is created set its visible property to no

        create two command buttons without the wizard make one's caption read search for existing client and the other's read Add New (or what ever captions you like)
        Set the visible property for the add new to no

        Choose the on click property of the Add New cmd and enter this code
        (you will need to change the names to match the objects on your form)

        Private Sub CmdNew_Click()

        Me.ClientText.V isible = True
        Me.CmdSearch.Vi sible = True
        DoCmd.GoToContr ol "ClientText "
        Me.ClientCombo. Visible = False
        Me.CmdNew.Visib le = False
        Me.Form.DataEnt ry = True

        End Sub

        Then go to the on click property for the Search Existing button and enter this code:

        Private Sub CmdSearch_Click ()

        Me.ClientCombo. Visible = True
        Me.CmdNew.Visib le = True
        DoCmd.GoToContr ol "ClientComb o"
        Me.ClientText.V isible = False
        Me.CmdSearch.Vi sible = False

        Me.Form.DataEnt ry = False

        End Sub

        once you test the code to see that it works stack the combo box on top of the text box and the command buttons on top of each other. and make them the same size

        the search combos visible property is set to no as is the add new button
        so when you open the form it will open in data entry mode with the text box visible to enter a new client and a button that reads "search for existing client" when that button is clicked the textbox will go invisible and the combo will become visible and the search button will go invisible and the add button will become visible. also the forms data entry property is changed to no. the add button returns every thing to the original settings

        I don't seem to be able to add a picture so I can e-mail you a screen shot if you like.
        [IMG]C:\Documents and Settings\Meg\My Documents\Form2 .bmp[/IMG]

        Comment

        Working...