Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
A simple question about queries
Message
 
 
To
15/02/2000 19:41:08
Marcelo Codino
Mystic & Faith - Sistemas -
Buenos Aires, Argentina
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00332657
Message ID:
00332667
Views:
14
>Hi all,
>
>If I have two tables one for clients and the other with pays, I want to know how can I build a query that lists all the payments of each client.For example, if I put Charles Robertson I want to know all the pays of Charles Robertson and so on.
>What controls should I put in my form? Can I use a combobox to the lastname, a textbox to the firstname and a grid for the payments? Should I build a parameterized view or not ?
>Please can you send me exactly what can I use for this ?
>I built a form with a combo to the lastname, a textbox for the firstname and a grid for payments, is it correct?
>
>tia

Sure. I might add a command button that say "Search..." or "Query..." Then I would have a parameterized view with a where clause like: ... where Lastname = ?cLastName and FirstName = ?cFirstName ... . Make the RecordSource of the grid the name of the parameterized view. Of course, you are forcing your users to know exact names of the clients.

You could do a preliminary retrieval based on some part of a lastname, have them select from a list of returned names [and primary key]. Then use the value of the primary key of the client they selected to pass to a view parameterized on the KeyID.

Preliminary retrieval --

cLastName = "%" + alltrim(ThisForm.txtLastName.Value) + "%"
requery("PreliminaryViewName")

The where clause of the initial view -- ... where LastName like ?cLastName

Then the other view -- ...where PrimaryKeyFieldName = ?nKeyID
Mark McCasland
Midlothian, TX USA
Previous
Reply
Map
View

Click here to load this message in the networking platform