Simple Code Block

  • Thread starter Thread starter dmills
  • Start date Start date
D

dmills

This Is My Code Block -
If [RFA TRACKING - App Checklist]![IS THE APPLICATION COMPLETE?] = -1 _
Then [Form_RFA Tracking - Review Tool]![Check_list_Complete] = -1
If [RFA TRACKING - App Checklist]![IS THE APPLICATION COMPLETE?] = 0 _
Then [Form_RFA Tracking - Review Tool]![Check_list_Complete] = 0
End If
End If

The error it gives me when I try to use the code is

end if without block if

does anyone understand what I might be doing wrong?
Thanks
 
dmills said:
This Is My Code Block -
If [RFA TRACKING - App Checklist]![IS THE APPLICATION COMPLETE?] = -1 _
Then [Form_RFA Tracking - Review Tool]![Check_list_Complete] = -1
If [RFA TRACKING - App Checklist]![IS THE APPLICATION COMPLETE?] = 0 _
Then [Form_RFA Tracking - Review Tool]![Check_list_Complete] = 0
End If
End If

The error it gives me when I try to use the code is

end if without block if

does anyone understand what I might be doing wrong?
Thanks


You're using single-line If statements -- "If <condition> Then
<statement>" -- not block If statements. Single-line If statements don't
use "End If" to terminate them; they end at the end of the statement.

From what I can see, though, I think the intended effect of your code block
can probably be accomplished by a single statement:

[Form_RFA Tracking - Review Tool]![Check_list_Complete] = _
[RFA TRACKING - App Checklist]![IS THE APPLICATION COMPLETE?]

However, I'm concerned about your form/control references. Is [Form_RFA
Tracking - Review Tool] supposed to be a reference to a form named "RFA
Tracking - Review Tool"? If so, you would do better to write it as

Forms![RFA Tracking - Review Tool]

The form must be open for that to work, but you shouldn't be using the
"Form_" reference syntax to open the form anyway.

What is [RFA TRACKING - App Checklist]? Is it a form? Subform on the form
where this code is running? The syntax would be correct if it's the name of
a subform on the current form, but otherwise there's a problem with this
reference, too.
 
Dirk Goldgar said:
dmills said:
This Is My Code Block -
If [RFA TRACKING - App Checklist]![IS THE APPLICATION COMPLETE?] = -1 _
Then [Form_RFA Tracking - Review Tool]![Check_list_Complete] = -1
If [RFA TRACKING - App Checklist]![IS THE APPLICATION COMPLETE?] = 0 _
Then [Form_RFA Tracking - Review Tool]![Check_list_Complete] = 0
End If
End If

The error it gives me when I try to use the code is

end if without block if

does anyone understand what I might be doing wrong?
Thanks


You're using single-line If statements -- "If <condition> Then
<statement>" -- not block If statements. Single-line If statements don't
use "End If" to terminate them; they end at the end of the statement.

From what I can see, though, I think the intended effect of your code block
can probably be accomplished by a single statement:

[Form_RFA Tracking - Review Tool]![Check_list_Complete] = _
[RFA TRACKING - App Checklist]![IS THE APPLICATION COMPLETE?]

However, I'm concerned about your form/control references. Is [Form_RFA
Tracking - Review Tool] supposed to be a reference to a form named "RFA
Tracking - Review Tool"? If so, you would do better to write it as

Forms![RFA Tracking - Review Tool]

The form must be open for that to work, but you shouldn't be using the
"Form_" reference syntax to open the form anyway.

What is [RFA TRACKING - App Checklist]? Is it a form? Subform on the form
where this code is running? The syntax would be correct if it's the name of
a subform on the current form, but otherwise there's a problem with this
reference, too.


--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
Lets put it this way... I have a form that I want this test performed when I
open the form ... so on the ON OPEN subroutine for the form I have this code
trying to perform... this is now what I have :

Private Sub Form_Open(Cancel As Integer)

If [RFA TRACKING - App Checklist]![IS THE APPLICATION COMPLETE?] = -1 Then
[Form_RFA Tracking - Review Tool]![Check_list_Complete] = -1
End If

If [RFA TRACKING - App Checklist]![IS THE APPLICATION COMPLETE?] = 0 Then
[Form_RFA Tracking - Review Tool]![Check_list_Complete] = 0
End If

End Sub
and it tells me now that Microsoft Access can't find the field '|' referred
to in your expression...
 
dmills said:
Dirk Goldgar said:
dmills said:
This Is My Code Block -
If [RFA TRACKING - App Checklist]![IS THE APPLICATION COMPLETE?] = -1
_
Then [Form_RFA Tracking - Review Tool]![Check_list_Complete] = -1
If [RFA TRACKING - App Checklist]![IS THE APPLICATION COMPLETE?] = 0 _
Then [Form_RFA Tracking - Review Tool]![Check_list_Complete] = 0
End If
End If

The error it gives me when I try to use the code is

end if without block if

does anyone understand what I might be doing wrong?
Thanks


You're using single-line If statements -- "If <condition> Then
<statement>" -- not block If statements. Single-line If statements don't
use "End If" to terminate them; they end at the end of the statement.

From what I can see, though, I think the intended effect of your code
block
can probably be accomplished by a single statement:

[Form_RFA Tracking - Review Tool]![Check_list_Complete] = _
[RFA TRACKING - App Checklist]![IS THE APPLICATION COMPLETE?]

However, I'm concerned about your form/control references. Is [Form_RFA
Tracking - Review Tool] supposed to be a reference to a form named "RFA
Tracking - Review Tool"? If so, you would do better to write it as

Forms![RFA Tracking - Review Tool]

The form must be open for that to work, but you shouldn't be using the
"Form_" reference syntax to open the form anyway.

What is [RFA TRACKING - App Checklist]? Is it a form? Subform on the
form
where this code is running? The syntax would be correct if it's the name
of
a subform on the current form, but otherwise there's a problem with this
reference, too.
Lets put it this way... I have a form that I want this test performed when
I
open the form ... so on the ON OPEN subroutine for the form I have this
code
trying to perform... this is now what I have :

Private Sub Form_Open(Cancel As Integer)

If [RFA TRACKING - App Checklist]![IS THE APPLICATION COMPLETE?] = -1 Then
[Form_RFA Tracking - Review Tool]![Check_list_Complete] = -1
End If

If [RFA TRACKING - App Checklist]![IS THE APPLICATION COMPLETE?] = 0 Then
[Form_RFA Tracking - Review Tool]![Check_list_Complete] = 0
End If

End Sub
and it tells me now that Microsoft Access can't find the field '|'
referred
to in your expression...


Since you didn't answer any of my questions, it's a little hard to help you.
But if you are trying to get information from a bound control on the form,
that form's Open event is too soon to be looking for it. You might use the
Load event or, better, the Current event.

If "RFA TRACKING - App Checklist" is the name of the form on which this code
is running, then you should use the keyword Me to refer to it:

If Me![IS THE APPLICATION COMPLETE?] = -1 Then
 
Back
Top