×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

grid shows last selected row

grid shows last selected row

grid shows last selected row

(OP)
In the form I first click on the approve button and then on the pending button. in a form add a button to show the records with state 0. I use version 6 of visual fox pro.

button approved procedure click

select f_temp
go top
scan
If f_temp.apprvd = .T.
select f_temp
replace f_temp.estado with 4 for empty(f_temp.desc_obj)

SELECT f_temp
for ve = 1 to reccount()
select f_temp
go ve
If f_temp.apprvd = .T.
update Pr set pr.estate = f_temp.state where pr.doc = f_temp.doc
endif
endfor

endif
endscan

select f_temp
go top
scan
If f_temp.aprobado = .T.
select f_temp
replace f_temp.estado with 5 for !empty(f_temp.desc_obj)

SELECT f_temp
for ve = 1 to reccount()
select f_temp
go ve
If f_temp.apprvd = .T.
update Pr set pr.estate = f_temp.state where pr.doc = f_temp.doc
endif
endfor

endif
endscan

select f_temp
go top

Thisform.pr.RecordSource = ""
Thisform.pr.RecordSource = "f_temp"

with thisform.pr
.recordsource = .recordsource
endwith

Thisform.pr.column1.ControlSource = "f_temp.lastn"
Thisform.pr.column2.ControlSource = "f_temp.lastn"
Thisform.pr.column3.ControlSource = "f_temp.mname"
Thisform.pr.column4.ControlSource = "f_temp.name"
Thisform.pr.column5.ControlSource = "f_temp.phone"
Thisform.pr.column6.ControlSource = "f_temp.state"
Thisform.pr.column7.ControlSource = "f_temp.obs"
Thisform.pr.column8.ControlSource = "f_temp.apprvd"

thisform.pr.setfocus()
Thisform.pr.refresh
thisform.refresh



button pending procedure click

select doc, lastn, mname, name, phone, state,obs, apprvd;
from f_temp ;
where f_temp.state = 0 into cursor f_temp2

select f_temp2
go top

Thisform.pr.RecordSource = "f_temp2"

with thisform.pr
.recordsource = .recordsource
endwith

Thisform.pr.column1.ControlSource = "f_temp2.lastn"
Thisform.pr.column2.ControlSource = "f_temp2.lastn"
Thisform.pr.column3.ControlSource = "f_temp2.mname"
Thisform.pr.column4.ControlSource = "f_temp2.name"
Thisform.pr.column5.ControlSource = "f_temp2.phone"
Thisform.pr.column6.ControlSource = "f_temp2.state"
Thisform.pr.column7.ControlSource = "f_temp2.obs"
Thisform.pr.column8.ControlSource = "f_temp2.apprvd"

thisform.pr.setfocus()
Thisform.pr.refresh
thisform.refresh

Only show the last record selected from the grid, how do I make it show all the records with state 0?

RE: grid shows last selected row

I noticed that you haven't had any replies to this question, nor to your thread184-1825069: grid updates erroneous information vfp6.

I suggest that you are more likely to get a helpful response if you explain more clearly what you are trying to achieve. In both of these cases, you have posted a large chunk of code with no explanation of what it is meant to do. You can't expect us to study the code and to try to figure out what is going wrong. Nor does it help to start two different threads both dealing with the same problem. That just gives us more work.

Also, when posting large code, it is really helpful to use the [code ][/code] tags, which you can enter either manually or from the "code" button on the toolbar. This will cause the code to be properly formatted, in particular with indentations, all of which make it easier for the code to be understood.

Please keep these points in mind. That way, we are more likely to be able to help you.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: grid shows last selected row

Quote (fanlinux)

how do I make it show all the records with state 0?
This question is stating your problem, you should begin our post with describing the problem, then going into details.

Your post actually isn't far off of being all we need to reproduce the problem and fix it. But we don't have your data available, so all that code doesn't help to reproduce and even see the problem.

What I can see is that the query where clause is correct:

CODE

...where f_temp.state = 0 

You fetch all records with state=0. You also go top, though a select into cursor will create f_temp2 with the current record pointer being at its top, unnecessary.

I can only conclude if you only see one record in this result, there also is only one record with status=0 and the problem here is not grid behavior or bugs, but your expectation of data, simply browse f_temp and see for yourself, SQL won't fail to fetch multiple records into ftemp2 if there are multiple with f_temp.state = 0, there is no SQL bug.

So I guess the problem is somewhere else setting only one record's state to 0 when you expect to accumulate multiple records with state=0 somehow.

If you can't make up a code example including the necessary code to produce sample data, like you see when you even just look into answers of MarK in this forum, then it's hardly realistic you can get help here.

Chriss

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close