Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / April 2008

Tip: Looking for answers? Try searching our database.

Form saves data, but does NOT display or update

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
vegathena@gmail.com - 01 Apr 2008 16:24 GMT
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!
Douglas J. Steele - 01 Apr 2008 16:40 GMT
Try removing the acFormEdit from the command. I think that overrides the
form's DataEntry property, and sets it to True.

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

>I am working with an adp with a SQL Server backend.
>
[quoted text clipped - 29 lines]
> data for a given record. I appreciate any help you can give in this
> matter!
vegathena@gmail.com - 01 Apr 2008 18:01 GMT
Doug, I removed acFormEdit as you suggested, but the form still
doesn't display the given record. Also, I continue to get the primary
key constraint violation error.

Any other ideas what could be wrong?

On Apr 1, 11:40 am, "Douglas J. Steele"
<NOSPAM_djsteele@NOSPAM_canada.com> wrote:
> Try removing the acFormEdit from the command. I think that overrides the
> form's DataEntry property, and sets it to True.
>
> --
> Doug Steele, Microsoft Access MVPhttp://I.Am/DougSteele
> (no e-mails, please!)
Douglas J. Steele - 01 Apr 2008 19:41 GMT
Sorry, no.

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

> Doug, I removed acFormEdit as you suggested, but the form still
> doesn't display the given record. Also, I continue to get the primary
[quoted text clipped - 10 lines]
>> Doug Steele, Microsoft Access MVPhttp://I.Am/DougSteele
>> (no e-mails, please!)
Bob Quintal - 02 Apr 2008 01:04 GMT
> Doug, I removed acFormEdit as you suggested, but the form still
> doesn't display the given record. Also, I continue to get the
> primary key constraint violation error.
>
> Any other ideas what could be wrong?

Is the form's data entry property set to yes?

Signature

Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.