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

Michael R Mattys michael.mattys at adelphia.net
Fri Aug 27 15:07:34 CDT 2004


> 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)

Keith,

No idea why, but two things you can try:

1) After DoCmd.CopyObject, try db.TableDefs.Refresh
2) Make sqlString = "Select * From tempfax_" & CurrentUser & chr(34)
     and use db.OpenRecordset(sqlString)
----

Michael R. Mattys
Mattys MapLib for Microsoft MapPoint
http://www.mattysconsulting.com





More information about the AccessD mailing list