This has been a recurring problem I have had. I have a parent form showing some of the contents of a single record in a parent table. This form contains a button that opens a specific subform (using an IF statement based on the contents of another field in the parent table/form. There are actually any of 8 child forms/tables that could be selected and the related record is in only one of them. The relation between the tables is based on the PK of the parent table and the related FK in the child table. and the data is correct in all tables.
My problem is that when I run this button on the parent form/table it returns the appropriate form/table, but displays the first record rather than the related record. In the past (using this same process) I have been successful in getting to the right record by fiddling with the where statement (sometimes putting in a equal sign or taking it out fixes the problem). However, I have no idea what is taking place and this time no matter what I do to the Where statement nothing works. I have not yet placed the final else condition for where the form selection field (VMValIdentType] is empty yet as there is no point at this time.
Here are the button macro contents:
If [VMValIdentType] = "Software"
OpenForm
Form Name: tmpVMValSW
View: Form
Filter Name:
Where Condition =: "[MBIDPK]="&"'"& [MBIDFK] &"'"
Data Mode:
Window Mode: Normal
Else IF [VMValIdentType] = "Another Variable" There are 8 of these
EndIF
I would just be happy if I had an idea of what I was doing when I am doing this so that in the future I might be able to keep this problem from occurring. I do understand what is supposed to happen, but obviously just enough to be dangerous.