You are here:

FoxPro/Find and then add data

Advertisement


Question
Hi,

When I click on find button to find a record, it finds the record and displays it properly in the form (text box, combo etc).
If i then add a record, the form does not display the newly added record. instead it displays the previous record that I found by clicking find button.

I am using control set in the text property. I am wondering why the table displays the previous search record instead of displying the last added record.

Thanks

Answer
Hi, welcome back!

  I don't have near enough information to be able to give you a direct answer here.  But, I can give you some things to look at:

1)  How did you get from "Find" to "Add" - if you just typed the new information on top of the record you found, you could have overwritten it.

2)  Are you sure the new record is actually being added to the table?  

3)  Where do the fields on the form (text, combo, etc) get their information?  i.e. What's their control source?  (table.field or m.variable?)

4)  If all the objects point directly to the table (ControlSource= table.field), AND you are sure the data is added to a new record, it may require nothing more than moving the record pointer and refreshing the form.  The easiest way to get to do this is:
   GO RECCOUNT()
   THISFORM.REFRESH
(NOTE: If the table has an active index, GO BOTTOM goes to the last indexed record, not necessarily the last record in the table.)

   If you are using "INSERT INTO" to add the new record this (#4) is more likely.  If you "APPEND BLANK" then populate the fields in the new record, the pointer will already be moved.

If this doesn't help, and you have more information available, please send a follow-up.

FoxPro

All Answers


Answers by Expert:


Ask Experts

Volunteer


Fred Frase

Expertise

Questions about development only. No installation or hardware specific questions, please. Your first step in requesting assistance should be to identify the version of FoxPro you are using. I can write short functions but, PLEASE do not ask me to write programs for you.

Experience

Nearly 30 years professional programming experience using FoxPro (FoxBase through VFP 9) or other xbase language, primarily in Windows environments.

Education/Credentials
Completed a 1,000 hour diploma course in programming at International Academy of Ohio (subsequently merged with Southern Ohio College).

©2016 About.com. All rights reserved.