Can't get code to run

R

RobUCSD

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
 
D

Douglas J. Steele

Try changing

Else: Me.AllowDeletions = False

so that it's two separate lines:

Else
Me.AllowDeletions = False
 
R

RobUCSD

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
 
D

Douglas J. Steele

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

why is my form dirty? 6
Mandatory Fields 4
Form running very slow after upgrade 0
Nasty Error 94 msg 10
Lock records against edits 3
Locking a record via a form 2
error 2499 9
Allow Edits 2

Top