-
Moving to Next Record, and updating Data Bound Controls
Hey guys,
have a problem. i am forced to use DataEnvionment so dont suggest otherwise. i know it sux.
anyway i have a few controls which is kind of 'data bound' to a recordset in a data environment.
now i want to do a simple record navigation.
like .movenext, etc.
but when i movenext from the Recordset, the DataBound controls doesnt update with the new data. infact, nothing visibly happens.
any suggestions ?
this is the code im using
Private Sub cmdNext_Click()
If DataEnv.rsLect.State <> adStateClosed Then DataEnv.rsLect.Close
DataEnv.rsLect.Open
DataEnv.rsLect.MoveNext
DataEnv.rsLect.Close
End sub
thanks
Deane.
-
Re: Moving to Next Record, and updating Data Bound Controls
I always displays the first record...right?
-
Moving to Next Record, and updating Data Bound Controls
-
Re: Moving to Next Record, and updating Data Bound Controls
By default the Open method selects the first record in the recordset... since your repeatedly opening the rs...
Also since your closing the rs with each click then the data bound controls will not be bound to an open recordset.
If the recordset will be navigated throughout the duration of the form life, then issue the Open method in the Form load event... and the close method in the form unload event.
-
Re: Moving to Next Record, and updating Data Bound Controls
hey Leinad,
thanks. i tried what you said but the result is the same. ??
-
Re: Moving to Next Record, and updating Data Bound Controls
I also tried giving a simple command like
MsgBox DataEnv.rsLect.Fields("FName")
in this case it outputs the correct record name. just that the DataBound Controls my text boxes, etc dont update.
i tried textbox.refresh that too doesnt seem to work
-
Re: Moving to Next Record, and updating Data Bound Controls
Have you set the DataSource, DataField, etc properties of the textboxes?
-
Re: Moving to Next Record, and updating Data Bound Controls
hey Lein, Thanks again. yes i have.
figured it out though, have to RE SET the Data Source each time you move a record.
for e.g
Set txtFName.DataSource = DataEnv
insanity!
cheers
Deane.
-
Re: Moving to Next Record, and updating Data Bound Controls
There should have been no need to reset anything with code actually since its all pre-determined and data bound during design time.
Resorting to progmatic means during run-time defeats the pupose of using the data environment.
-
Re: Moving to Next Record, and updating Data Bound Controls
i agree, but does anyone else have a better way of doing it? or anyway of doing it for that matter ? :)
-
Re: Moving to Next Record, and updating Data Bound Controls
-
Re: Moving to Next Record, and updating Data Bound Controls
:) like i said im stuck with DateEnv
-
Re: Moving to Next Record, and updating Data Bound Controls
Is this source code your predecessor's and was passed on to you?
You can still use SQL + ADO rather than updating/adding to the data environment.
-
Re: Moving to Next Record, and updating Data Bound Controls
no no it's an assingment man :) specifically DataEnv :) thanks for the help tho.
-
Re: Moving to Next Record, and updating Data Bound Controls
IMO, teachers really should stop over-emphasizing the use of these data-bound controls...
If you have the time, it would be better for you to learn ADO... the data environment is just a point-click GUI wrapper for ADO... so if you already know ADO, then learning the use of the data environment is easier... and the underlying concepts are more important, especially when your already a professional programmer.
-
Re: Moving to Next Record, and updating Data Bound Controls
Quote:
Originally Posted by leinad31
IMO, teachers really should stop over-emphasizing the use of these data-bound controls...
When you have 2 weeks to teach database programming, that's about the only way you can do it.
-
Re: Moving to Next Record, and updating Data Bound Controls
I was aware of the time constraint, its use for instruction is unavoidable but they should let the students know thats its just a GUI wrapper... that's what I meant by over emphasizing.
And since you mentioned the limited time period hehehehe. Most programmers expect themselves to work for companies in the future... all companies have accounting related activities (report generation included)... database use is usually related to these accounting related activities... hence a competitive (in the typical/non-specialized business sector) graduate should be given more exposure to database programming (and accounting basics), not just two weeks crash course.
That's just my opinion on the matter ;)