Re: can't edit record anymore in a form

From: Steve Schapel (schapel_at_mvps.org.ns)
Date: 01/21/05


Date: Sat, 22 Jan 2005 07:09:33 +1300

Guilin,

Have you changed the query that the form is based on? If you open the
query data***, can you edit records in there?

-- 
Steve Schapel, Microsoft Access MVP
guilin wrote:
> the Allow Edit and Allow Additions properties of the form are all set
> to be true but it won't allow me to change records. I used some code to
> promp before edit:
> 
> **********code starts*********************
> 
> Private Sub Form_BeforeInsert(Cancel As Integer)
> 'ask user if they want to add a record
> Dim strMsg As String
> 
> strMsg = "Do you want to add a new invoice?"
> strMsg = strMsg & "Click Yes to add or No to cancel."
> 
> If MsgBox(strMsg, vbQuestion + vbYesNo, "Add Record?") = vbYes Then
> AllowAdditions = True
> Else
> Cancel = True
> End If
> 
> End Sub
> 
> Private Sub Form_BeforeUpdate(Cancel As Integer)
> 'ask user if they want to save the updated record
> Dim strMsg As String
> Dim intResponse As Integer
> 
> strMsg = "You are about to change this invoice detail. "
> strMsg = strMsg & "Do you wish to save the changes?"
> strMsg = strMsg & "Click Yes to Save or No to Discard changes."
> 
> intResponse = MsgBox(strMsg, vbYesNoCancel, "Update Data?")
> 
> Select Case intResponse
> Case vbYes
> Case vbNo
> DoCmd.RunCommand acCmdUndo
> Cancel = True
> Case vbCancel
> Cancel = True
> End Select
> 
> End Sub
> 
> **********************code ends**********************************
> this form also has a parent form so it can be opened from its parent or
> on its own, don't know whether it changes things?
> thanks for all advice....................
>