Table not receiving data 
Author Message
 Table not receiving data

Hi,

This is Access97.

I have a form with a button to copy the records to a table.  The code
follows:

Rather than writing to the working table, [karaoke] to test the code, I
create a copy of its structure and named it [karaoketest].

This line obviously sets the recordset variable rsKaraoke to table
Karaoketest.

    Set rsKaraoke = db.OpenRecordset("Karaoketest", dbOpenDynaset)

After testing the procedure and it working fine, I changed the line to:
    Set rsKaraoke = db.OpenRecordset("Karaoke", dbOpenDynaset)

but the Karaoke table isn't receiving data.

To make certain that the table name isn't a spelling error I copied and
pasted the table name from the database window. Still didn't work.

Im stumped.  I must be missing something, but have no idea what.

The code is below. Newdisk is a temp table which the form is bound to.
All I am doing is transferring records from one table to another.

'*** Code

'Check for Records in form

If Me.RecordsetClone.RecordCount = 0 Then
    MsgBox "There are no records to save!"
    Exit Sub
End If

    Dim db As Database
    Dim rsKaraoke As Recordset
    Dim rsNewDisk As Recordset
    Dim Criteria As String

    Set db = CurrentDb
    Set rsKaraoke = db.OpenRecordset("Karaoketest", dbOpenDynaset)
    Set rsNewDisk = Me.RecordsetClone
    Dim i As Integer

'Check for existing Disk
    Criteria = "[Kardisknum] = '" & [kardisknum] & "'"
    rsKaraoke.FindFirst Criteria
    If Not rsKaraoke.NoMatch Then
        MsgBox "Disk number " & [kardisknum] & " is already on the
list!"
        Exit Sub
    End If

'Transfer records to Karaoke from current form
    rsNewDisk.MoveFirst

    Do Until rsNewDisk.EOF

        With rsKaraoke
            .AddNew
                For i = 0 To rsKaraoke.Fields.Count - 1
                    On Error Resume Next
                    rsKaraoke.Fields(i) =
rsNewDisk.Fields(rsKaraoke.Fields(i).Name)
                Next i
            .Update
        End With
    rsNewDisk.MoveNext

    Loop

    MsgBox "Record Saved"

'*** End code

Thanks for any insight to the problem

Mark A. Sam
--

Administrator
Truckloads.Net
---
Those who can do; Those who can't become talk show hosts!
---
Plan-It-Earth Web Management Services
P.O. Box 110
Dunkirk, New York   14048
---
Phone:   716-679-7607

Website: http://www.*-*-*.com/



Wed, 26 Dec 2001 03:00:00 GMT  
 Table not receiving data
Have you verified that no errors are being raised?

--
Dirk Goldgar

(please direct email replies to

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.



Wed, 26 Dec 2001 03:00:00 GMT  
 Table not receiving data

Quote:

> Have you verified that no errors are being raised?

I did now and there were errors.  I put the resume next there
temporarily and it slip my notice.

I had to remove the ID field from the temp table and account for it on
the working table.

   If rsKaraoke.Fields(i).Name <> "KarID" Then
     rsKaraoke.Fields(i) = rsNewDisk.Fields(rsKaraoke.Fields(i).Name)
   End If

That little {*filter*} did the trick..

Thanks.

Mark A. Sam
--

Administrator
Truckloads.Net
---
Those who can do; Those who can't become talk show hosts!
---
Plan-It-Earth Web Management Services
P.O. Box 110
Dunkirk, New York   14048
---
Phone:   716-679-7607

Website: http://www.*-*-*.com/



Thu, 27 Dec 2001 03:00:00 GMT  
 Table not receiving data
Mark,

looks to me like you're trying to update the karaoke table's values with
the test table's field names. if the structures are the same, then  the
following should work.

rsKaraoke.Fields(i) =rsNewDisk.Fields(i)

Larry

Quote:

> Hi,

> This is Access97.

> I have a form with a button to copy the records to a table.  The code
> follows:

> Rather than writing to the working table, [karaoke] to test the code, I
> create a copy of its structure and named it [karaoketest].

> This line obviously sets the recordset variable rsKaraoke to table
> Karaoketest.

>     Set rsKaraoke = db.OpenRecordset("Karaoketest", dbOpenDynaset)

> After testing the procedure and it working fine, I changed the line to:
>     Set rsKaraoke = db.OpenRecordset("Karaoke", dbOpenDynaset)

> but the Karaoke table isn't receiving data.

> To make certain that the table name isn't a spelling error I copied and
> pasted the table name from the database window. Still didn't work.

> Im stumped.  I must be missing something, but have no idea what.

> The code is below. Newdisk is a temp table which the form is bound to.
> All I am doing is transferring records from one table to another.

> '*** Code

> 'Check for Records in form

> If Me.RecordsetClone.RecordCount = 0 Then
>     MsgBox "There are no records to save!"
>     Exit Sub
> End If

>     Dim db As Database
>     Dim rsKaraoke As Recordset
>     Dim rsNewDisk As Recordset
>     Dim Criteria As String

>     Set db = CurrentDb
>     Set rsKaraoke = db.OpenRecordset("Karaoketest", dbOpenDynaset)
>     Set rsNewDisk = Me.RecordsetClone
>     Dim i As Integer

> 'Check for existing Disk
>     Criteria = "[Kardisknum] = '" & [kardisknum] & "'"
>     rsKaraoke.FindFirst Criteria
>     If Not rsKaraoke.NoMatch Then
>         MsgBox "Disk number " & [kardisknum] & " is already on the
> list!"
>         Exit Sub
>     End If

> 'Transfer records to Karaoke from current form
>     rsNewDisk.MoveFirst

>     Do Until rsNewDisk.EOF

>         With rsKaraoke
>             .AddNew
>                 For i = 0 To rsKaraoke.Fields.Count - 1
>                     On Error Resume Next
>                     rsKaraoke.Fields(i) =
> rsNewDisk.Fields(rsKaraoke.Fields(i).Name)
>                 Next i
>             .Update
>         End With
>     rsNewDisk.MoveNext

>     Loop

>     MsgBox "Record Saved"

> '*** End code

> Thanks for any insight to the problem

> Mark A. Sam
> --

> Administrator
> Truckloads.Net
> ---
> Those who can do; Those who can't become talk show hosts!
> ---
> Plan-It-Earth Web Management Services
> P.O. Box 110
> Dunkirk, New York   14048
> ---
> Phone:   716-679-7607

> Website: http://www.plan-it-earth.net



Wed, 09 Jan 2002 03:00:00 GMT  
 Table not receiving data

Quote:

> Mark,

> looks to me like you're trying to update the karaoke table's values with
> the test table's field names. if the structures are the same, then  the
> following should work.

> rsKaraoke.Fields(i) =rsNewDisk.Fields(i)

> Larry

Thanks Larry, but I had an ID field in the Temp table which I had to
remove, also I had to place a check for a filed in the Karaoke table
being the ID (Autonumber).  Obviouly it doennt need to get assigned.

   If rsKaraoke.Fields(i).Name <> "KarID" Then
     rsKaraoke.Fields(i) = rsNewDisk.Fields(rsKaraoke.Fields(i).Name)
   End If

Mark A. Sam
--

Administrator
Truckloads.Net
---
Those who can do; Those who can't become talk show hosts!
---
Plan-It-Earth Web Management Services
P.O. Box 110
Dunkirk, New York   14048
---
Phone:   716-679-7607

Website: http://www.plan-it-earth.net



Thu, 10 Jan 2002 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. MSComm - not receiving "0" data correctly

2. Winsock Control Might Not Receive Large chunk of data

3. eVB/CE3: Binary data received is not what is being sent

4. is net.socket able to block receiving data until it handles the data

5. Not getting data using WHERE clause between table and recordset

6. Some fields in my table does not store the new data but only NULL

7. Help: updating text file-Updating Data in a linked table not supported by this ISAM

8. Data Report does not match current table

9. Trying to get data from MS Access table (not using ASP)

10. Crystal: duplicate data in table need to filter with record selection not suppress field

11. slq guru help needed: how to select data not in another table using sql

12. Display a blank screen if picture data is not found in sql table

 

 
Powered by phpBB® Forum Software