Topic: in shape does not show result of request
Access 2010 from Office Professional 2010, Russian
There is form Frm, a mode - Only reading, a type - the Table.
Data source - SQL request from table Tbl1, which on a key field x1 (type String)
It is connected to table Tbl2, the relation "one-to-many".
Table Tbl2 is connected to table Tbl3 on NOT to a key field x2 (type String).
bl1. [x1] it is displayed in Frm. [x], type - a field.
In Frm. [y], type - the field with the list - should be displayed result SQL of request from Tbl3.
All happens in event OnOpen of form Frm:
Private Sub Form_Open (Cancel As Integer) Dim RecSource As String, S As String RecSource = varSQL_PK ' global variable with query name Me. RecordSource = RecSource S = Me. [x] ' a key field With [y] .BoundColumn = 1 .RowSource = _ "SELECT Tbl3. [x2], Tbl3. [x3] FROM Tbl3" + _ "INNER JOIN (Tbl2" + _ "INNER JOIN" + RecSource + _ "ON Tbl2. [x1] =" + RecSource + ". [x1])" + _ "ON Tbl3. [x2] =Tbl2. [x2]" + _ "WHERE Tbl2. [x1] = '" + _ S + "'" + _ "ORDER BY Tbl3. [x3];" .RowSourceType = "Table/Query" .ColumnCount = 2 .ColumnWidths = "0; 3,652" .LimitToList = True .AllowValueListEdits = False .InheritValueList = True .Requery End With End Sub
1) at form discovery all column Frm. [y] empty though at a choice of any [y] the list of fields opens
2) [y] the list of records is identical to all, since in a condition of selection Access puts ONLY
The first record from Me. [x] though it is necessary - the value for each record on the form.
If to remove WHERE - the same effect, only in the list all records.
In what an error?
Respond, who knows, PLEASE!
P.S. For Frm. [y] in Tbl1 there is a field [y] - whether it is possible somehow in Tbl1 to do without it?
Since the form only for review, it is not necessary to store result of request.