[AccessD] Data copied to both tables????

Keith Williamson k.williamson5 at verizon.net
Sat Aug 28 20:22:06 CDT 2004


No.  "tblfax" is an empty table that gets copied to the "tempfax_" &
CurrentUser table.  Once that is copied, all the unbound fields on the form
are copied to the "tempfax_" & CurrentUser table.  But for some reason the
data from the unbound fields is showing up in both tables.  Both tables were
empty before the update command, but both have the data afterwards.  I can't
figure it out.  :(

Regards,

Keith Williamson

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Mike & Doris
Manning
Sent: Friday, August 27, 2004 4:37 PM
To: 'Access Developers discussion and problem solving'
Subject: RE: [AccessD] Data copied to both tables????

Could it be because the first thing you do is copy whatever is in (tempfax_
& currentuser) to tblfax on the line...

    DoCmd.CopyObject , "tempfax_" & CurrentUser, acTable, "tblfax"

You then add the new record but the next time this runs, the whole of
(tempfax_ & currentuser) will get copied to tblfax.

Doris Manning
Database Administrator
Hargrove Inc.
www.hargroveinc.com


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Keith Williamson
Sent: Friday, August 27, 2004 11:39 AM
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] Data copied to both tables????


Can someone please tell me why the code below adds data to BOTH the tblfax
table AND the (tempfax_& currentuser) table??????

I'm at wits end here.  All the fields being added to recordset "mytable2"
are from unbound fields in the open form.  The intent here is to copy an
empty table "tblfax" (which has no data), and call it "tempfax_" & current
user.....copy the forms data to this table...and use it for the data source
for a report.  For some reason...the data is being copied to both tables.  I
can't understand why.  Any ideas???




Dim db As Database
    Dim stDocName As String
    Dim mytable2 As Recordset
    Dim sqlstring As String
    Dim recSource As String

    Set db = CurrentDb

    DoCmd.CopyObject , "tempfax_" & CurrentUser, acTable, "tblfax"
    Set mytable2 = db.OpenRecordset("tempfax_" & CurrentUser)
    
    With mytable2
    .AddNew
        ![faxto] = [TempFaxTo]
        ![phonenum] = [tempphone]
        ![faxfrom] = [TempFrom]
        ![faxnum] = [TempFaxNum]
        ![Pages] = [TempPages]
        ![urgent] = [TempUrgent]
        ![review] = [TempForReview]
        ![comment] = [TempPleaseComment]
        ![reply] = [TempPleaseReply]
        ![message] = [TempMessage]
    .Update
    End With


Thanks,

Keith E. Williamson
Ashland Equipment, Inc
phone # (410) 273-1856
fax #     (410) 273-1859



-- 
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

-- 
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com





More information about the AccessD mailing list