SplitFormDatasheet property

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
 
D

Doctor

Which line are you get the compile error on? This might help someone figure
it out more easily.

Does changing the line: Forms![frmTerms].SplitFormDatasheet.AllowEdits
to Forms![frmTerms].AllowEdits do what you want?
 
C

ct4accessHelp

Hi Doctor,
Thanks for your reply; the line
<<Forms![frmTerms].SplitFormDatasheet.AllowEdits>> comes up highlighted with
the error on Debug. I tried just using
<<Forms![frmTerms].AllowEdits>>however, that still gives me a compile error,
plus--it's the datasheet portion of the form that is read-only the actual
form itself allows edits. I attempted:
Me.SplitFormDatasheet.Allow Edits
in the On Got Focus event of the form but that gives me a compile error as
well. Any other thoughts?...

Doctor said:
Which line are you get the compile error on? This might help someone figure
it out more easily.

Does changing the line: Forms![frmTerms].SplitFormDatasheet.AllowEdits
to Forms![frmTerms].AllowEdits do what you want?


ct4accessHelp said:
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
 
D

Doctor

I'm not sure if you can set a split form to two different properties. Someone
else may have to help here.

But try Me.AllowEdits = False (You can use "Me" to refer to itself in the
form's module instead of Forms!frmTerms)
Or me.AllowEdits = True

But again, this will apply to the entire form. So it wont accomplish exactly
what your after. It doesn't seem like the splitformdatasheet has its own
property of AllowEdits.

Doctor said:
Which line are you get the compile error on? This might help someone figure
it out more easily.

Does changing the line: Forms![frmTerms].SplitFormDatasheet.AllowEdits
to Forms![frmTerms].AllowEdits do what you want?


ct4accessHelp said:
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
 
C

ct4accessHelp

Hi Doc, thanks again for your help. SplitFormDatasheet does have its own
property setting in ACCESS 2007 and it works fine when I set it from the
properties window. It's trying to reset/unset it in VB that is causing me
heartache.

Does anyone else have any thoughts, or can you recommend a different way to
allow users to edit a form after validating a password?

Doctor said:
I'm not sure if you can set a split form to two different properties. Someone
else may have to help here.

But try Me.AllowEdits = False (You can use "Me" to refer to itself in the
form's module instead of Forms!frmTerms)
Or me.AllowEdits = True

But again, this will apply to the entire form. So it wont accomplish exactly
what your after. It doesn't seem like the splitformdatasheet has its own
property of AllowEdits.

Doctor said:
Which line are you get the compile error on? This might help someone figure
it out more easily.

Does changing the line: Forms![frmTerms].SplitFormDatasheet.AllowEdits
to Forms![frmTerms].AllowEdits do what you want?


ct4accessHelp said:
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
 
D

Doctor

Figured it out.

Me.SplitFormDatasheet = acDatasheetAllowEdits
OR
Me.SplitFormDatasheet = acDatasheetReadOnly

Now I know too. I'm sure I'll use this sometime.


ct4accessHelp said:
Hi Doc, thanks again for your help. SplitFormDatasheet does have its own
property setting in ACCESS 2007 and it works fine when I set it from the
properties window. It's trying to reset/unset it in VB that is causing me
heartache.

Does anyone else have any thoughts, or can you recommend a different way to
allow users to edit a form after validating a password?

Doctor said:
I'm not sure if you can set a split form to two different properties. Someone
else may have to help here.

But try Me.AllowEdits = False (You can use "Me" to refer to itself in the
form's module instead of Forms!frmTerms)
Or me.AllowEdits = True

But again, this will apply to the entire form. So it wont accomplish exactly
what your after. It doesn't seem like the splitformdatasheet has its own
property of AllowEdits.

Doctor said:
Which line are you get the compile error on? This might help someone figure
it out more easily.

Does changing the line: Forms![frmTerms].SplitFormDatasheet.AllowEdits
to Forms![frmTerms].AllowEdits do what you want?


:

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
 
C

ct4accessHelp

OMG!!!!! Doctor you are the DOCTOR!!! Thanks you sosososososo very much!! It
works like a charm. ;-)

Doctor said:
Figured it out.

Me.SplitFormDatasheet = acDatasheetAllowEdits
OR
Me.SplitFormDatasheet = acDatasheetReadOnly

Now I know too. I'm sure I'll use this sometime.


ct4accessHelp said:
Hi Doc, thanks again for your help. SplitFormDatasheet does have its own
property setting in ACCESS 2007 and it works fine when I set it from the
properties window. It's trying to reset/unset it in VB that is causing me
heartache.

Does anyone else have any thoughts, or can you recommend a different way to
allow users to edit a form after validating a password?

Doctor said:
I'm not sure if you can set a split form to two different properties. Someone
else may have to help here.

But try Me.AllowEdits = False (You can use "Me" to refer to itself in the
form's module instead of Forms!frmTerms)
Or me.AllowEdits = True

But again, this will apply to the entire form. So it wont accomplish exactly
what your after. It doesn't seem like the splitformdatasheet has its own
property of AllowEdits.

:

Which line are you get the compile error on? This might help someone figure
it out more easily.

Does changing the line: Forms![frmTerms].SplitFormDatasheet.AllowEdits
to Forms![frmTerms].AllowEdits do what you want?


:

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
 

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

Top