Information générale
Catégorie:
Codage, syntaxe et commandes
Another option is to use a parameterized view for your control source.
Create a view of your table named, for instance, v_Customer
In the filter condition set the value of the name field to ?cViewParm
Set the NoDataOnLoad property of the view cursor to .T.
This also works best if you set the form's buffermode to 2 - Optimistic Row.
You will have to start with a new blank record, so in the init of the form
APPEND BLANK IN v_Customer
In the valid method of the name text box do something like:
*--The variable has to be private so it will be in scope when you
*--requery the view
PRIVATE cViewParm
cViewParm = THIS.Value
REQUERY('v_Customer')
*--You need to add a blank record at this point
*--if there were no matches in the name field
IF _TALLY = 0
APPEND BLANK IN v_Customer
RETURN .F.
ENDIF
When the user (it sounds like that's you) presses enter in the Name field, you get your record if it is there. Otherwise you have a blank record in which to enter a new customer. You have to use the TABLEUPDATE() function in your save method to write the information in the buffer to the actual table on disk.
HTH
Pamela
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement