Results 1 to 6 of 6
  1. #1
    Join Date
    Dec 2003
    Location
    The Netherlands
    Posts
    98

    Unanswered: What am I doing wrong?

    Hi,

    I have a form and a button on that form which, when clicked, should go to the additional info that is stored in another form. I inserted the following code:


    Private Sub ButtonName_Click()
    DoCmd.OpenForm "frmMelding", acViewNormal, , "Melding_ID=forms!frmMeldingenOverzicht!Melding_ID "

    End Sub

    ..but I must be doing something wrong because the new form (frmMelding) opens to the first record in that form and not to the record that I specified.

    PLEASE help because I don't know what I am doing wrong.

  2. #2
    Join Date
    Jan 2004
    Location
    Romania - Bucharest
    Posts
    50
    try Me.Melding_ID=forms!frmMeldingenOverzicht!Melding_ ID

  3. #3
    Join Date
    Dec 2003
    Location
    The Netherlands
    Posts
    98

    No luck

    That doesn't work. It asks me for a parameter and then shows me a blanc form.

  4. #4
    Join Date
    Jan 2004
    Location
    Bratislava - Slovakia
    Posts
    3
    Hi,

    try to make your button with the wizard.

    And read the wizard very, very carefuly. You will find the right solution for you.
    You shold either delete the old button or simple make a new one.

    After them you should look to the code, whats the wizards result. This is a good way to learn code.

    Have a nice day.

    Max

  5. #5
    Join Date
    Jun 2003
    Location
    Belgium
    Posts
    133
    Charlotte,

    je problemen ken ik ook. Ze hebben meestal te maken met het feit dat Access problemen heeft met controls op een form die precies dezelfde naam dragen als de field waarvoor ze gebruikt worden.

    Maak er een goede gewoonte van om je controls een andere naam te geven. Voorbeeld voor het veld MeldingID gebruik je bijv. een control die je de naam txtMeldingID geeft.
    Dan wordt je code het volgende :
    DoCmd.OpenForm "frmMelding", acViewNormal, , "Melding_ID=forms!frmMeldingenOverzicht!txtMelding _ID"

    Let er op dat in de Where-clause eerst de veldnaam gebruikt moet worden van de te openen form en dan de naam van de control op de eerste form.

    Probeer maar eens.

  6. #6
    Join Date
    Dec 2003
    Location
    The Netherlands
    Posts
    98
    thankyou,

    the problem is though that the 'new' report is a query based on a table. So I don't see how I can change the names. I'll think about it and thankyou very much for your help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •