Display a specific record by clicking an open form button in MS Access 2007 doen't work

62,995

I think the problem is here:

DoCmd.OpenForm "Project_readonly", , , "People_readonly.[Project_ID] = " & Me![id]

With the Record Source for your People_readonly form as the Project table, you want the WhereCondition parameter to select the Project row whose Id value matches the current form's Project_ID value.

If that sounds right, try it this way:

DoCmd.OpenForm "Project_readonly", , , "Id = " & Me!Project_ID
Share:
62,995
Vadim
Author by

Vadim

Updated on November 24, 2020

Comments

  • Vadim
    Vadim over 3 years

    Assume I have 2 tables in MS Access:

    Table about some people which work for some company:

    enter image description here

    And table about some projects which some company holds:

    enter image description here

    I also have two corresponding forms for tables (the question is typed on the big button):

    enter image description here enter image description here

    I have searched in internet for a solution, I tried some, but haven't achieved a desired goal, here are two of them:

    DoCmd.OpenForm "Project_readonly", , , "People_readonly.[Project_ID] = " & Me![id]
    
    DoCmd.OpenForm "Project_readonly", , , _
    "People_readonly.[Project_ID] = '" & _
    Project_readonly.id & "'"
    

    Also while searching I found many other people having the same problem, they try some queries, but they don't work. Some also say that Wizard has some errors, so that it doen't produce working code. So I ask if is it possible that one filled the code for the attached BD file of mine and upload it here? Would be much thanks! Here is the file: http://www.sendspace.com/file/pf9tov . If you provide your solution, it would be also very good if you explain how it works!

    Also please provide a good tutorial which exmplains Visual Basic clearly, whithout overbloat and specifically for MS Access usage, I have found some, but they are for windows forms.