Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2003
    Location
    Vietnam
    Posts
    188

    Unanswered: newly-added record appeared as #Deleted#

    Hi Guys,

    i use ms access connecting mysql via ODBC, the form's underlying table has an autonumber field (primary key). Most of the time (not ALL the time) when i add a new record, the form displays the newly-added record as #DELETED# for all fields on the form. But the new record was actually added to table. i have to close down the form, open it again and then move to that record to continue.

    my workaround for this now is that i dont let access add the autonumber itself, i write a function to add the number instead. this works so far but i still want to know how to fix it.

    anybody can help? TIA
    qha_vn

  2. #2
    Join Date
    Feb 2002
    Posts
    403
    Requery the form using the maximum record number as the filter and iut should pull up the last record.

  3. #3
    Join Date
    Jan 2003
    Location
    Vietnam
    Posts
    188
    thanks for the reply, but the form has

    form.recordsource=strSQL

    and i cant capture the newly-created autonumber for the strSQL string

    Any thing else we could think of
    qha_vn

  4. #4
    Join Date
    Feb 2002
    Posts
    403
    Try something like:

    Dim lngID as Long
    Dim strSQL as String

    lngID=0

    strSQL="Select etc

    Call CheckForSave(lngID)

    if lngID=0 then
    Me.Recordsource=strSQL
    Else
    Me.recordsource=strSQL & "WHERE ID = " & lngID
    End if

    CheckForSave(lngID as Long)

    If me.newrecord then

    lngID=Something

    Else

    lngID=Somethingelse

    End if

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •