V
vegathena
I am working with an adp with a SQL Server backend.
I have a bound form that contains the id in the form header. The
detail section contains several fields. This form saves a new record
just fine. The problem is that when I try open the form for an
existing record (by id), the form displays blank. When I go ahead and
re-enter data into those fields and try to save, I get a "Violation of
Primary Key constraint; cannot insert duplicate key"
This form has a Form_Current sub that checks for a NewRecord.
NewRecord always shows 'true' even when the record already exists.
Here is the code that opens this form:
DoCmd.OpenForm "frmTest", , , "id=" & Global_id, acFormEdit, ,
Me.OpenArgs
Here is the form code:
Private Sub Form_Current()
If Me.NewRecord Then
Me.txtid = Global_id
End If
End Sub
This form has the following properties:
Record Source: test_table
Allow filters: No
Data Entry: No
Recordset Type: Updatable Snapshot
Cycle: Current Record
I need this form to not only save data, but also to display and update
data for a given record. I appreciate any help you can give in this
matter!
I have a bound form that contains the id in the form header. The
detail section contains several fields. This form saves a new record
just fine. The problem is that when I try open the form for an
existing record (by id), the form displays blank. When I go ahead and
re-enter data into those fields and try to save, I get a "Violation of
Primary Key constraint; cannot insert duplicate key"
This form has a Form_Current sub that checks for a NewRecord.
NewRecord always shows 'true' even when the record already exists.
Here is the code that opens this form:
DoCmd.OpenForm "frmTest", , , "id=" & Global_id, acFormEdit, ,
Me.OpenArgs
Here is the form code:
Private Sub Form_Current()
If Me.NewRecord Then
Me.txtid = Global_id
End If
End Sub
This form has the following properties:
Record Source: test_table
Allow filters: No
Data Entry: No
Recordset Type: Updatable Snapshot
Cycle: Current Record
I need this form to not only save data, but also to display and update
data for a given record. I appreciate any help you can give in this
matter!