That is the complete statement.
Form_PROCESS_COMPLIANCE.FullM15 = DLookup("[NonCompliance]", _
"Form-Process-Compliance", "GOVERNANCE_PATH='" _
& Lite & "' And [REVIEWED_GATE] ='" & M06 & "'")
Let me break it down for you and see if it makes more sense, or perhaps I
did not copy from the original code correctly.
[NonCompliance] is the name of the field that DLookup will return a value
from based on the Criteria which is the third argument.
Form-Process-Compliance is the name of the table containing the field
[NonCompliance]. Looking at it again, it may be the form name as I copied it
from your code. In any case, it needs to be the name of the table
"GOVERNANCE_PATH='" _
& Lite & "' And [REVIEWED_GATE] ='" & M06 & "'")
GOVERNANCE_PATH is another field in your table. It will find a row where
the value in GOVERNANCE_PATH is equal to something name Lite. I suggest in
be enclosed in brackets like the other field names.
[REVIEWED_GATE] is another field in your table. It will find a row where
the value in [REVIEWED_GATE] is equal to something named M06.
The DLookup will return the value in the [NonCompliance] field where both
the above Criteria match.
Let me know if there is more you need.
PH said:
Dear Klatuu,
Good afternoon.
Thanks for your help, however, I still couldn't execute this command.
I need to know all commands before and after to execute this command you
suggest:
Form_PROCESS_COMPLIANCE.FullM15 = DLookup("[NonCompliance]", _
"Form-Process-Compliance", "GOVERNANCE_PATH='" _
& Lite & "' And [REVIEWED_GATE] ='" & M06 & "'")
For example, is there any connection object that I need to set?
Could you please, provide me the complete command to execute it?
Thanks and regards.
PH.
Klatuu said:
There are a couple of issues here to determine how to do this. I can't tell
from your select statement whether you are expecting more that one row to be
returned by this query. Based on this line:
Form_PROCESS_COMPLIANCE.FullM15 = qryTest
it appears that is what you are doing. A query would not be the best way to
do this. I would recommend a DLookup function:
Form_PROCESS_COMPLIANCE.FullM15 = DLookup("[NonCompliance]", _
"Form-Process-Compliance", "GOVERNANCE_PATH='" _
& Lite & "' And [REVIEWED_GATE] ='" & M06 & "'")
:
Dears,
Good afternoon.
Could someone help me on this?
I have the event procedure bellow, and I don't know how can I execute this
select statement to returns me the value I am asking for FullM15 field.
The question is: What commands I need to insert here to execute this query
and put the value into the Form_PROCESS_COMPLIANCE.FullM15 field?
Private Sub Form_Open(Cancel As Integer)
Dim qryTest As String
qryTest = "SELECT [Form-Process-Compliance].NonCompliance FROM
[Form-Process-Compliance] WHERE [Form-Process-Compliance].GOVERNANCE_PATH='"
& Lite & "' And [Form-Process-Compliance].REVIEWED_GATE='" & M06 & "';"
Form_PROCESS_COMPLIANCE.FullM15 = qryTest
End Sub
Thanks and regards.
PH.