Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Refresh is not working 4

Status
Not open for further replies.

LeonelSanchezJr

Programmer
Joined
Jan 26, 2001
Messages
522
Location
US
I am using ThisForm.Refresh(), but my fields on the form are not being enabled.

I am setting all of my fields to .enabled = .T., however, when I do ThisForm.Refresh(), the fields are not enabled.

The syntax that I have in Refresh are:

CLEAR TYPEAHEAD
SELECT csrHelpdesk
IF RECCOUNT() < 1
THISFORM.olecontrol1.BtEnabled(2) = .F.
ENDIF

What's wrong with my form?
 
Are the fields bound to data? Is there a record in the table/view they are bound to?
 
Yes, the fields are bound to a cursor. I am trying to blank out all fields in order to add a &quot;NEW&quot; record.
 
Many OLE controls need an extra qualification (&quot;object&quot;) for some properties and/or methods, try:

THISFORM.olecontrol1.object.BtEnabled(2) = .F.

Rick
 
If they bound, when you do an append blank they will refresh and look enabled. If you are at eof or the cursor is empty they will look disabled even if they are set to enabled.
 
***** The problem is they are BOUND to a CURSOR and you CANNOT UPDATE a Cursor.

Any suggestions?
 
Then how/why are you doing data entry. Either bind the fields to a table or a view. Or you could use the cursor again which would allow you to update the cursor, for all the good it would do since the cursor is not tied to anything.
 
This application used to use Remote Views and now I have to remove the Remote Views, so I'm trying to do the best I can without dramatically changing the code.




 
The else condition in the refresh method may solve the problem.

CLEAR TYPEAHEAD
SELECT csrHelpdesk
IF RECCOUNT() < 1
THISFORM.olecontrol1.BtEnabled(2) = .F.
ELSE
THISFORM.olecontrol1.BtEnabled(2) = .T.
ENDIF

ramani :-9
(Subramanian.G)
FoxAcc
ramani_g@yahoo.com
 
OK, I'll bite. What is the back end? Why did you stop using remote views. If you switched to VFP tables why are you not using local views? If someone told you to stop using remote views because of performance issues, and is having you switch to sql passthru, first get a big 2x4 ...

 
The back end is SQL 2000. The reason for discontinuing the use of remote views is because if any field or table is changed, the remote views are messed up and this causes more work.

So, instead we are bringing the data into a cursor and upon updating the information, we update the SQL database.

Is this not the best solution?
 
So, instead we are bringing the data into a cursor and upon updating the information, we update the SQL database.

I'm a bit confused. To update the SQL database when you've changed the underlying table or field, you're going to have to make the same change you'd have to make to the remote view aren't you? You can always create the remote view in code. So just drop the old view and recreate the view using whatever changes are necessary. You can cut and paste a lot of the code. Just right click in the view designer and select view SQL to get the select statement for instance.

Dave Dardinger

 
Hi!

As about remote views - they are messed up just because they're based on the query like 'SELECT * FROM ...'. Of course, when new field added, such query returns another record set, thus view is messed. When you use a fields list in the SELECT statement, this problems goes away. Just change the order of field in the fields list in the view designer. this will change the view's query to use fields list instead. Of course, if you want to use new field in the vaie, you require to change the view (but not re-create it).
Many people use Remote Views...
A lot of people store view queries in the table and re-create the if needed using CREATE SQL VIEW command and DBSETPROP function to make it updatable. This is not such a big problem, indeed.

Hope this helps.

Vlad Grynchyshyn
vgryn@softserve.lviv.ua
The professional level of programmer could be determined by level of stupidity of his/her bugs
 
Go back to views. The amount of code you are going to write to avoid using them is much greater than the problem with the remote views getting messed up. Try to avoid views that do a select *. There is also a program around called genview which will generate code from the view in the dbc. I use it a lot to recover a view that has gotten wierd. You should be able to download it from one of the vfp shareware sites. If not contact me and I will email it to you.
 
Have you tried simply putting This.Refresh() in the active event on your page
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top