|
-
May 14th, 2006, 01:09 PM
#1
Thread Starter
Hyperactive Member
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.
-
May 14th, 2006, 01:17 PM
#2
Re: Moving to Next Record, and updating Data Bound Controls
I always displays the first record...right?
-
May 14th, 2006, 01:19 PM
#3
Thread Starter
Hyperactive Member
Moving to Next Record, and updating Data Bound Controls
Last edited by deane034; May 14th, 2006 at 03:33 PM.
me.life = VB
-
May 14th, 2006, 01:51 PM
#4
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.
-
May 14th, 2006, 02:10 PM
#5
Thread Starter
Hyperactive Member
Re: Moving to Next Record, and updating Data Bound Controls
hey Leinad,
thanks. i tried what you said but the result is the same. ??
-
May 14th, 2006, 02:16 PM
#6
Thread Starter
Hyperactive Member
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
-
May 14th, 2006, 02:21 PM
#7
Re: Moving to Next Record, and updating Data Bound Controls
Have you set the DataSource, DataField, etc properties of the textboxes?
-
May 14th, 2006, 03:32 PM
#8
Thread Starter
Hyperactive Member
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.
-
May 14th, 2006, 03:35 PM
#9
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.
-
May 14th, 2006, 03:37 PM
#10
Thread Starter
Hyperactive Member
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 ?
-
May 14th, 2006, 03:38 PM
#11
Re: Moving to Next Record, and updating Data Bound Controls
-
May 15th, 2006, 12:54 AM
#12
Thread Starter
Hyperactive Member
Re: Moving to Next Record, and updating Data Bound Controls
like i said im stuck with DateEnv
-
May 15th, 2006, 01:03 PM
#13
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.
Last edited by leinad31; May 15th, 2006 at 01:28 PM.
-
May 15th, 2006, 01:40 PM
#14
Thread Starter
Hyperactive Member
Re: Moving to Next Record, and updating Data Bound Controls
no no it's an assingment man specifically DataEnv thanks for the help tho.
-
May 15th, 2006, 03:40 PM
#15
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.
-
May 15th, 2006, 04:03 PM
#16
Re: Moving to Next Record, and updating Data Bound Controls
 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.
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.
Please Help Us To Save Ana
-
May 18th, 2006, 01:38 PM
#17
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
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
|