Macros and Programming


CardboxForumsMacros and Programming > "Searching and Positioning of database windows"

Searching and Positioning of database windows

Posted By Post


6-Mar-2006 11:28

I have two different databases customer and payment. When I view a customer record in the customer database I want Cardbox to automatically search for and display all the payments made by the customer from the payment database in a summary format. Can someone suggest what the programming for this will look like?

Also the positioning of the database windows for customer and payment on the screen. I want to open the customer database window and open the payment database window and Cardbox to resize and place the windows on the screen approprately so that the content is seen clearly without the user having to manually place and resize the windows. Can someone suggest what the programming for this will look like? Alternatively is there a way to place one database window inside another e.g the list of the customer payemnts to be embedded inside the cusomer database window.

Charles Welling

19-Mar-2006 15:12

As to your first and second question: take your manual and read all about relational searching. And the Windows, Tile menu will position your windows so that users can easily view both databases. You can record the steps to turn on relational searching in a macro, so you don't need to do the programming yourself. But as I promised Cardboss to help out, here's a macro that I use myself which will give you an idea. Adapt it where needed. It assumes that the connecting field in both databases is "CUSTOMER_NAME". It

- Activates your payments database if already open
- If not already open it opens the payments database
- Only if the selection level is "0" a relational link will be created
- The windows will be tiled

on error resume next
Activate "Payments"
if err.number <> 0 then
OpenFile "Myserver://Payments",,"search" 'search is the name of the profile
Activate "Payments"
end if

if SelectionLevel = 0 then
SelectRelational "CUSTOMER_NAME","Customers","CUSTOMER_NAME",cbxRelationalUseAllTermsOR+cbxRelationalUseIndexedOnly+cbxRelationalMatch+cbxRelationalBlankFieldMatchesNothing
end if

Activate "Customers"

And as to your third question: it is possible to place a window on top of another, but it would require an "always on top" option to keep it visible. That would be something for Cardboss.


© 2010 Cardbox Software Limited   Home