|
-
Jul 24th, 2003, 07:52 PM
#1
Thread Starter
Lively Member
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.
-
Jul 26th, 2003, 06:39 AM
#2
Fanatic Member
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?
-
Jul 28th, 2003, 07:23 PM
#3
Thread Starter
Lively Member
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?
-
Jul 30th, 2003, 06:52 AM
#4
Thread Starter
Lively Member
-
Jul 30th, 2003, 10:52 AM
#5
Fanatic Member
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.
-
Jul 30th, 2003, 05:54 PM
#6
Thread Starter
Lively Member
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?
-
Jul 31st, 2003, 02:51 AM
#7
Fanatic Member
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.
-
Jul 31st, 2003, 06:07 PM
#8
Thread Starter
Lively Member
Thank you for the idea but it didn't seem to help. It still comes up with the messages.
-
Aug 1st, 2003, 02:33 AM
#9
Fanatic Member
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.
-
Aug 1st, 2003, 02:59 AM
#10
Thread Starter
Lively Member
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.
-
Aug 3rd, 2003, 06:06 PM
#11
Thread Starter
Lively Member
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:
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
Do While myDataEnvironment.rslogTable.RecordCount > 0 'While there are records to delete
myDataEnvironment.rslogTable.MoveFirst 'Move to the first record
myDataEnvironment.rslogTable.Delete 'Delete it
myDataEnvironment.rslogTable.Update 'Update the table
myDataEnvironment.rslogTable.Close 'Requery
myDataEnvironment.rslogTable.Open
Loop
Me.Refresh
' Refresh screen
Call checkRecordsLog 'Method to refresh the GUI
End If
frmMain.setStatus ("Ready.") 'Update the status bar
frmMain.Refresh
End Sub
-
Aug 4th, 2003, 09:41 AM
#12
Junior Member
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
-
Aug 4th, 2003, 08:20 PM
#13
Thread Starter
Lively Member
OMG THAT WORKED!
VB Code:
private sub ThankYou()
msgbox "Thankyou"
Call ThankYou
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|