Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>When using the "Me" reference, you need to ensure the code is behind the present form, you've mentioned that the Form_Load code is on there, but is the "subPfadFilter" somewhere else?</p> <p>If so then it needs to either be moved on to this form, or change your reference to the forms name instead of "Me".</p> <p>If it is on the form then the error seems to be complaining about the CDT item, you will need to confirm that this is the name of either a text field or a control on this form.</p> <p>If it is then you can try inserting:</p> <pre><code>Me.Requery </code></pre> <p>After your SQL statement, this may wake up the forms reference to the object.</p> <p>This bit is not essential but to avoid carrying out two tests on CDT and streamlining your code slightly I would amend to this:</p> <pre><code>If Me.CDT &amp; "" = "" Then strAuswahl = "*" Else strAuswahl = Me.CDT blnFiltOn = True End If </code></pre> <p>This captures both Is Null or "" in one shot.</p> <p>UPDATE:</p> <p>For an unbound form, you need to set your form's controls via VB as well as the forms recordsource e.g:</p> <pre><code>Private Sub Form_load() Dim rs As Recordset Set rs = CurrentDb.OpenRecordset("SELECT DISTINCTROW b.* " &amp; _ "FROM tb_bauteile As b LEFT JOIN FehlerCodes_akt_Liste As f " &amp; _ "ON b.CDT = f.CDT " &amp; _ "WHERE f.Steuergerät = 'MEDC17' " &amp; _ "ORDER BY f.Fehlerpfad;") rs.MoveFirst Me.CDT = rs!CDT 'Any other fields go here rs.Close Set rs = Nothing End Sub </code></pre> <p>However if you are returning more than one record at a time then you will either need to stick with a bound form or perhaps use a listbox to display your information. Unbound forms do not use the Forms "Recordset" property.</p> <p>Note: I have also 'Aliased' the table names in your SQL statement, this is a good practice to get into : )</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload