Compile error: Method or data member not found

trishlstang

New member
Local time
Yesterday, 22:50
Joined
Oct 30, 2014
Messages
5
I am getting this error and it focuses on the first line which matches the cmd wording or SetFocus under the results. I have matched the name and control but still getting this error. Plese Help.:banghead:

Private Sub cmdGetGeneralApplicationResults_Click()
If Me.[ApplicationQ1].Value = 1 Or Me.[ApplicationQ2].Value = 1 Or Me.[ApplicationQ3].Value = 1 Or Me.[ApplicationQ4] = 1 Or Me.[ApplicationQ9] = 1 Or Me.[ApplicationQ10] = 1 Or Me.[ApplicationQ11] = 1 Or Me.[ApplicationQ12] = 1 Or Me.[ApplicationQ13] = 1 Or Me.[ApplicationQ14] = 1 Then
Me.[ApplicationResult1].SetFocus
Me.[ApplicationResult1].Text = "ERROR"
Me.[ApplicationResult2].SetFocus
Me.[ApplicationResult2].Text = "Y Processing Error"

If Me.[ApplicationQ1].Value = 0 Or Me.[ApplicationQ2].Value = 0 Or Me.[ApplicationQ3].Value = 0 Or Me.[ApplicationQ4] = 0 Or Me.[ApplicationQ9] = 0 Or Me.[ApplicationQ10] = 0 Or Me.[ApplicationQ11] = 0 Or Me.[ApplicationQ12] = 0 Or Me.[ApplicationQ13] = 0 Or Me.[ApplicationQ14] = 0 Then
Me.[ApplicationResult1].SetFocus
Me.[ApplicationResult1].Text = "No ERROR"
Me.[ApplicationResult2].SetFocus
Me.[ApplicationResult2].Text = "NA No Error"
End If
End If

End Sub

Private Sub cmdGetEmergencyApplicationResults_Click()
If Me.[EmergencyQ5].Value = 1 Or Me.[EmergencyQ6].Value = 1 Or Me.[EmergencyQ7].Value = 1 Or Me.[EmergencyQ8] = 1 Then
Me.[EmergencyResult1].SetFocus
Me.[EmergencyResult1].Text = "ERROR"
Me.[EmergencyResult2].SetFocus
Me.[EmergencyResult2].Text = "Y Processing Error"

If Me.[EmergencyQ5].Value = 0 Or Me.[EmergencyQ6].Value = 0 Or Me.[EmergencyQ7].Value = 0 Or Me.[EmergencyQ8] = 0 Then
Me.[EmergencyResult1].SetFocus
Me.[EmergencyResult1].Text = "No ERROR"
Me.[EmergencyResult2].SetFocus
Me.[EmergencyResult2].Text = "NA No Error"
End If
End If

End Sub
 
All of the ApplicationQ1-14 are controls on the form? The implication is that it can't find one. Can you post the db here?

By the way, you don't need the SetFocus lines, just don't use the .Text property when setting the value. .Value is the default, and it doesn't require focus.
 
Why do you start writing the code like this "Me.[ApplicationQ1].Value = 1" and then in the same statement start writing it like this "Me.[ApplicationQ4] = 1"
 
You don't have those controls in you form like [ApplicationResult1].
In the form they are known as "S100ApplicationResult1" etc.
Check up which actually are control in the form and what they are called and which are field names in the table.
 
They are all different questions. That is why I have Q1 through Q14
 
I tried to remove the SetFocus and I get a compile error. I did correct the results button but now the command is not working.
 
You added controls for the tests being done in the If/Then, or changed to the correct names? Also the controls being set? If you type "Me." you should get intellisense to choose from the available controls. If you type in one that doesn't exist, you're going to get errors.
 
They are all different questions. That is why I have Q1 through Q14
Read post #5 again.
Set the form in design view and go trough all control for getting the correct name, insert the correct mane in the.
In your code you point to a control called [ApplicationResult1], but you don't have a control with that name, it is called [S100ApplicationResult1].
An example, you've:
Code:
Me.[B][COLOR=Red][ApplicationResult1][/COLOR][/B].SetFocus
Me.[COLOR=Red][B][ApplicationResult1].Text[/B][/COLOR] = "ERROR"
It should be:
Code:
Me.[COLOR=Red][B][S100ApplicationResult1][/B][/COLOR].SetFocus
Me.[COLOR=Red][B][S100ApplicationResult1][/B][/COLOR] = "ERROR"
And as pbaldy mention:
.. you don't need the SetFocus lines, just don't use the .Text property when setting the value. .Value is the default, and it doesn't require focus.
 

Users who are viewing this thread

Back
Top Bottom