C
ct4accessHelp
I am attempting to set the splitformdatasheet property using VB. Here's the
scenario: I am using ACC2007 and have a split form that displays as a
datasheet. I want the datasheet to be read only when users initally access
the form; however, to update the form requires a password (which I have
successfully accomplished using a custom dialog). The user must enter the
valid [stored] password and if valid the OK button gives the focus back to
the split form and is supposed to set the SplitFormDatasheet property to
Allow Edits. BUT!!!... it will NOT work, I keep getting a COMPILE error:
INVALID USE OF PROPERTY. Please HEEEEELPPPPP!!!... my code is as follows...
Private Sub OK_Click()
On Error GoTo Err_OK_Click
Dim strMsg As String, strTitle As String
Dim intStyle As Integer
Dim strDocName As String
strDocName = "Update"
' If the terms update form is not being opened for editing cause an error.
DoCmd.OpenForm "Update", acNormal, , "FormName= '" & "Update" & "'"
Forms!Update.Visible = False
If Not (Me.Password = Forms![Update]![Password]) Or
IsNull(Me.Password) Then Err.Raise 0
' Close Update form and open the form to update terms.
DoCmd.Close acForm, strDocName
Forms![frmTerms].SetFocus
Forms![frmTerms].SplitFormDatasheet.AllowEdits
' Hide form.
Me.Password.SetFocus
Me.Password.Value = ""
Me.Visible = False
Exit_OK_Click:
Exit Sub
Err_OK_Click:
'MsgBox Err.Description
strMsg = "The password you entered does not match the stored password.
Please " _
& "enter the correct password or click Cancel to use the command
buttons on the " _
& "Main Menu."
intStyle = vbCritical
strTitle = "Invalid Password"
Me.Password.SetFocus
Me.Password.Value = ""
DoCmd.CancelEvent
Resume Exit_OK_Click
End Sub
scenario: I am using ACC2007 and have a split form that displays as a
datasheet. I want the datasheet to be read only when users initally access
the form; however, to update the form requires a password (which I have
successfully accomplished using a custom dialog). The user must enter the
valid [stored] password and if valid the OK button gives the focus back to
the split form and is supposed to set the SplitFormDatasheet property to
Allow Edits. BUT!!!... it will NOT work, I keep getting a COMPILE error:
INVALID USE OF PROPERTY. Please HEEEEELPPPPP!!!... my code is as follows...
Private Sub OK_Click()
On Error GoTo Err_OK_Click
Dim strMsg As String, strTitle As String
Dim intStyle As Integer
Dim strDocName As String
strDocName = "Update"
' If the terms update form is not being opened for editing cause an error.
DoCmd.OpenForm "Update", acNormal, , "FormName= '" & "Update" & "'"
Forms!Update.Visible = False
If Not (Me.Password = Forms![Update]![Password]) Or
IsNull(Me.Password) Then Err.Raise 0
' Close Update form and open the form to update terms.
DoCmd.Close acForm, strDocName
Forms![frmTerms].SetFocus
Forms![frmTerms].SplitFormDatasheet.AllowEdits
' Hide form.
Me.Password.SetFocus
Me.Password.Value = ""
Me.Visible = False
Exit_OK_Click:
Exit Sub
Err_OK_Click:
'MsgBox Err.Description
strMsg = "The password you entered does not match the stored password.
Please " _
& "enter the correct password or click Cancel to use the command
buttons on the " _
& "Main Menu."
intStyle = vbCritical
strTitle = "Invalid Password"
Me.Password.SetFocus
Me.Password.Value = ""
DoCmd.CancelEvent
Resume Exit_OK_Click
End Sub