Microsoft Knowledge Base Email Alertz

KBAlertz.com: In Visual FoxPro 3.0b, when a view is created and default value is set using DBSETPROP, the newly-appended records contain the default value in a Browse/Append window; but the default values disappear after TABLEUPDATE() and REQUERY().

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]

Search KbAlertz

Advanced Search

Webmasters
Put kbAlertz on your website.
[ Click Here for more! ]





ASP.NET 3.5 Web Hosting with Windows 2008 and SQL 2008: Click Here!
Discount ASP.NET Hosting
ASP.NET 2.0 and 3.5
Windows2008 and SQL2008
US and UK Hosting
KBAlertz referrals get
** SIX MONTHS FREE **


Community Site



We Send hundreds of thousands of emails using ASP.NET Email


ASP.NET 3.5 Web Hosting with Windows 2008 and SQL 2008: Click Here!
Discount ASP.NET Hosting
ASP.NET 2.0 and 3.5
Windows2008 and SQL2008
US and UK Hosting
KBAlertz referrals get
** SIX MONTHS FREE **




Mentioned In








Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks




Article ID: 163029 - Last Review: October 15, 2003 - Revision: 3.1

FIX: Default Value Does Not Update Table in Local/Remote View

This article was previously published under Q163029

On This Page

SYMPTOMS

In Visual FoxPro 3.0b, when a view is created and default value is set using DBSETPROP, the newly-appended records contain the default value in a Browse/Append window; but the default values disappear after TABLEUPDATE() and REQUERY().

RESOLUTION

Instead of using default value in a view, manually code some ON KEY LABEL that inserts the default values when appending a new record. Since this bug is fixed in Visual FoxPro 5.0, the best way to avoid it is upgrading to Visual FoxPro 5.0.

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This bug has been corrected in Visual FoxPro 5.0.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Copy and Paste the following code, and save this file as Prog1.prg under C:\KBTEST
          CLOSE DATABASES
          SET DEFAULT TO C:\KBTEST
    
          * Create a database and open it
    
          IF NOT FILE('Table1.dbf')
             CREATE DATA Data1
             CREATE TABLE Table1 (ID C (8) Primary Key, State C (2))
             SET MULTILOCKS ON
             =CURSORSETPROP('Buffering', 5, 'Table1' )
          ELSE
             OPEN DATABASE Data1 EXCLUSIVE
          ENDIF
    
          * Create a view based on Table1
    
          CREATE SQL VIEW View1 AS SELECT * FROM Table1
    
          = DBSETPROP('View1.ID', 'Field', 'KeyField', .T.)
          = DBSETPROP('View1.ID', 'Field', 'UpdateName','Table1.ID')
          = DBSETPROP('View1.ID', 'Field', 'Updatable', .T.)
          = DBSETPROP('View1.State', 'Field', 'Updatable', .T.)
          = DBSETPROP('View1', 'View', 'SendUpdates', .T.)
    
          * Set the view DefaultValue property
          = DBSETPROP('View1.State', 'Field', 'DefaultValue', "'WA'")
    
          SELECT 0
          USE View1
          BROWSE
    							
  2. Run Prog1.prg.
  3. With the View1 Browse window open, append a records by pressing CTRL+Y, and then enter a unique ID value. Add several records this way. The default value of field STATE is automatically inserted as "WA."
  4. Close the View1 Browse window.
  5. In the Command window, issue the following commands to refresh the update to Table1, and refresh View1 by retrieving data from Table1:
          = TABLEUPDATE(.T.)
          = REQUERY()
    							
  6. Open the Table1 and View1 Browse windows. The STATE field value, "WA," of the newly appended records turns into blank.

APPLIES TO
  • Microsoft Visual FoxPro 3.0b Standard Edition
  • Microsoft Visual FoxPro 3.0b for Macintosh
Keywords: 
kbbug kbfix kbvfp500fix KB163029
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate

Be the first to leave feedback, to help others about this knowledge base article.

(Optional) Name

(Optional) Public URL Or Email

Comments
No HTML -- Text Only Please