Results 1 to 13 of 13

Thread: Error: "Unable to bind to field or datamember: <Field name>"

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2003
    Location
    Brisbane, Australia
    Posts
    72

    Error: "Unable to bind to field or datamember: <Field name>"

    Hi guys i've have been getting this error in my program and i have tried everything to fix it.

    Error: "Unable to bind to field or datamember: <Field name>"
    <Field name> is the name of a data field that i have assigned to a text field on the form.

    My forms contain text fields that are bound to data fields through the data environment manager.

    This error comes up once I delete every record from the table then reload the form. If new records are added after all are deleted then nothing will show up either.

    Does anyone know how to fix this. At the moment the user has to quit the program and reload it for it not to bring these errors.

  2. #2
    Fanatic Member
    Join Date
    Oct 1999
    Location
    England
    Posts
    982
    What kind of recordset are you using in the data environment.
    Some recordsets do not pick up changes to the data.

    Have you refreshed the recordset?

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jul 2003
    Location
    Brisbane, Australia
    Posts
    72
    I'm not sure what kind of recordset it would be called but here is how it is set up.

    I have an access database which is connected to the program via the data environment manager.

    In this data connection i have the tables refereneced under the connection. I then add, edit, delete etc by accessing the records attributed to the tables in the connection.

    This whole method has worked wonderfully except on this one problem. I only happens if the last record is deleted in a table. If i quit my program and reload it it all works fine.

    Any thoughts?

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Jul 2003
    Location
    Brisbane, Australia
    Posts
    72
    bump

  5. #5
    Fanatic Member
    Join Date
    Oct 1999
    Location
    England
    Posts
    982
    In the command properties window it tells you the cursortype, cursorlocation etc

    Here is a bried explanation of the different cursors and how they work.

    Dynamic cursor — allows you to view additions, changes, and deletions by other users; allows all types of movement through the Recordset that doesn't rely on bookmarks; and allows bookmarks if the provider supports them.

    Keyset cursor — behaves like a dynamic cursor, except that it prevents you from seeing records that other users add, and prevents access to records that other users delete. Data changes by other users will still be visible. It always supports bookmarks and therefore allows all types of movement through the Recordset.

    Static cursor — provides a static copy of a set of records for you to use to find data or generate reports; always allows bookmarks and therefore allows all types of movement through the Recordset. Additions, changes, or deletions by other users will not be visible. This is the only type of cursor allowed when you open a client-side (ADOR) Recordset object.

    Forward-only cursor — behaves identically to a static cursor except that it only allows you to scroll forward through records. This improves performance in situations where you need to make only a single pass through a Recordset.

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Jul 2003
    Location
    Brisbane, Australia
    Posts
    72
    Curser type is set to Static (option box is disabled)
    Curser location is 2 - Client Side
    Recordset Returning is clicked on

    What changes do you think i need to make?

  7. #7
    Fanatic Member
    Join Date
    Oct 1999
    Location
    England
    Posts
    982
    Double click on the dataenvironment in the project explorer so the dataenvironment explorer treeview window is displayed.

    Click on the command.

    In the properties window you will see the properties for the command, this is where you can change the cursortype.

    I would suggest changing the cursortype to 2 - adOpenDynamic. see previous post for description.

    I think that should help.

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Jul 2003
    Location
    Brisbane, Australia
    Posts
    72
    Thank you for the idea but it didn't seem to help. It still comes up with the messages.

  9. #9
    Fanatic Member
    Join Date
    Oct 1999
    Location
    England
    Posts
    982
    The only other thing I can think of is the recordset may need refreshing or I think the method is requery.

    I haven't actually bound controls to a dataenvironment before so I can only relate to what I know.

    Is it possible you could post some of the project so I could have a better look at it.

  10. #10

    Thread Starter
    Lively Member
    Join Date
    Jul 2003
    Location
    Brisbane, Australia
    Posts
    72
    Well no, the problem is that the database is 129mb. Its a very very large base (i had to import from their last system).

    I could post the code for the deleting.

    I thought about requery. But reading up on it, apparently all it does is .close and .open which I already do.

    I won't be back to the office until monday so i'll post some code then.

    I've tried everything and really don't understand what is messing up. Since everything works fine if the program is closed and opened again I know that it is related to the last record being deleted.

  11. #11

    Thread Starter
    Lively Member
    Join Date
    Jul 2003
    Location
    Brisbane, Australia
    Posts
    72
    This is the code that clears the records out for the logs. I keep fiddling with this code to see if I can stop the error from happening but there never seems to be a change.

    VB Code:
    1. Private Sub butClearLogs_Click()
    2.     frmMain.setStatus ("Clearing out the logs.")    'Update status bar
    3.     frmMain.Refresh
    4.     If MsgBox("Do you wish to clear out the logs table?", (vbYesNo + vbCritical + vbDefaultButton2), "Delete?") = vbYes Then
    5.         Do While myDataEnvironment.rslogTable.RecordCount > 0   'While there are records to delete
    6.             myDataEnvironment.rslogTable.MoveFirst  'Move to the first record
    7.             myDataEnvironment.rslogTable.Delete     'Delete it
    8.             myDataEnvironment.rslogTable.Update     'Update the table
    9.             myDataEnvironment.rslogTable.Close      'Requery
    10.             myDataEnvironment.rslogTable.Open
    11.         Loop
    12.         Me.Refresh
    13.         ' Refresh screen
    14.         Call checkRecordsLog    'Method to refresh the GUI
    15.     End If
    16.     frmMain.setStatus ("Ready.")        'Update the status bar
    17.     frmMain.Refresh
    18. End Sub

  12. #12
    Junior Member
    Join Date
    Nov 2002
    Location
    the Netherlands
    Posts
    24

    Wink

    Try the next code:


    Private Sub butClearLogs_Click()
    frmMain.setStatus ("Clearing out the logs.") 'Update status bar
    frmMain.Refresh
    If MsgBox("Do you wish to clear out the logs table?", (vbYesNo + vbCritical + vbDefaultButton2), "Delete?") = vbYes Then
    with myDataenvironment.rslogTable
    if .reccount >0 then 'While there are records to delete
    .movefirst
    Do While not .eof
    .Delete 'Delete it
    .Update 'Update the table
    .movenext
    Loop
    endif
    .close
    .open
    end with
    Call checkRecordsLog 'Method to refresh the GUI
    End If
    frmMain.setStatus ("Ready.") 'Update the status bar
    frmMain.Refresh
    End Sub


    See if the error still occurs

    Greetings from the North Sea

  13. #13

    Thread Starter
    Lively Member
    Join Date
    Jul 2003
    Location
    Brisbane, Australia
    Posts
    72

    Talking

    OMG THAT WORKED!

    VB Code:
    1. private sub ThankYou()
    2.     msgbox "Thankyou"
    3.     Call ThankYou
    4. end sub

Posting Permissions

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



Click Here to Expand Forum to Full Width