Can't get code to run

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

with the code below i'm trying to limit who can edit the form to RNs only. I
get a complile error on the Then statement of, missing:) I can't seem to get
it to work.
Note that [VisitDate] = Date Then belongs to the line above it. (broken up
by the disscussion groups msg window.

Thanks, Rob

____________________________________________________________________
Private Sub Form_Current()
On Error GoTo Form_Current_Error

If (CurrentUser = Me.txtCreator _
And IsUserInGroup(CurrentUser(), "RNs") _
And
[Forms]![frmPtDemographicNew]![frmVisitNewEdit].[Form]![VisitDate] = Date Then
Me.AllowDeletions = True
Me.AllowEdits = True



Else: Me.AllowDeletions = False
Me.AllowEdits = False


End If

On Error GoTo 0
Exit Sub

Form_Current_Error:

MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure
Form_Current of VBA Document Form_fsubRNnotes"
End Sub
 
Try changing

Else: Me.AllowDeletions = False

so that it's two separate lines:

Else
Me.AllowDeletions = False
 
Hi Doug, thanks for responding.

That didin't help. It still is getting hung up on "Then" Any additonal help
would be much appreciated.

Douglas J. Steele said:
Try changing

Else: Me.AllowDeletions = False

so that it's two separate lines:

Else
Me.AllowDeletions = False


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


RobUCSD said:
with the code below i'm trying to limit who can edit the form to RNs only.
I
get a complile error on the Then statement of, missing:) I can't seem to
get
it to work.
Note that [VisitDate] = Date Then belongs to the line above it. (broken up
by the disscussion groups msg window.

Thanks, Rob

____________________________________________________________________
Private Sub Form_Current()
On Error GoTo Form_Current_Error

If (CurrentUser = Me.txtCreator _
And IsUserInGroup(CurrentUser(), "RNs") _
And
[Forms]![frmPtDemographicNew]![frmVisitNewEdit].[Form]![VisitDate] = Date
Then
Me.AllowDeletions = True
Me.AllowEdits = True



Else: Me.AllowDeletions = False
Me.AllowEdits = False


End If

On Error GoTo 0
Exit Sub

Form_Current_Error:

MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure
Form_Current of VBA Document Form_fsubRNnotes"
End Sub
 
We're both blind.

You've got an opening parenthesis after the If. You don't have a closing
parenthesis before the Then.

(You still need the other fix I suggested though)

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


RobUCSD said:
Hi Doug, thanks for responding.

That didin't help. It still is getting hung up on "Then" Any additonal
help
would be much appreciated.

Douglas J. Steele said:
Try changing

Else: Me.AllowDeletions = False

so that it's two separate lines:

Else
Me.AllowDeletions = False


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


RobUCSD said:
with the code below i'm trying to limit who can edit the form to RNs
only.
I
get a complile error on the Then statement of, missing:) I can't seem
to
get
it to work.
Note that [VisitDate] = Date Then belongs to the line above it. (broken
up
by the disscussion groups msg window.

Thanks, Rob

____________________________________________________________________
Private Sub Form_Current()
On Error GoTo Form_Current_Error

If (CurrentUser = Me.txtCreator _
And IsUserInGroup(CurrentUser(), "RNs") _
And
[Forms]![frmPtDemographicNew]![frmVisitNewEdit].[Form]![VisitDate] =
Date
Then
Me.AllowDeletions = True
Me.AllowEdits = True



Else: Me.AllowDeletions = False
Me.AllowEdits = False


End If

On Error GoTo 0
Exit Sub

Form_Current_Error:

MsgBox "Error " & Err.Number & " (" & Err.Description & ") in
procedure
Form_Current of VBA Document Form_fsubRNnotes"
End Sub
 
Back
Top