TOPIC: Browse in Access
#951
Browse in Access 3 Years, 1 Month ago
My database is a set of homes where I track sales. I want to be able to enter all of the data at the same time. My two tabels are "lots" and "sales". This code almost works. The only problem is that lotNumber in "lots" shows a blank (I have some data already.)

Code:


Controller
{
Controls:
(Access
title: "Enter Lot Data"
lots
(Vert
(Horz (lotNumber) Skip streetAddress streetName)
(Skip)
(Browse
"sales",
columns: (saleDate, saleAmount, saleSource, saleNote)
linkField: lotNumber,
name: "lotNumber"
)
)
)
}



Here is the field definition for lotNumber:
Code:

Field_number
{
Prompt: 'Lot'
Control: (Number width: 5 justify:'LEFT')
Format: (Text width:5 )
}

 
 
#952
Re:Browse in Access 3 Years, 1 Month ago
Oh, I know why your problem is occurs,
You are linking on a field (lotNumber) that is being used elsewhere. The access control only allows 1:1 ratio.

To work around this (in the past) I made the link based on a rule field (which simply returned this.lotNumber)

I think I may have posted a sample elsewhere but I cant seem to find it :-(

z
 
 
#953
Re:Browse in Access 3 Years, 1 Month ago
Used elsewhere?

I tried to copy this directly from Master-Detail Relationship in the manual. It's a beautiful and useful screen that I need to get working :huh:
 
 
#954
Re:Browse in Access 3 Years, 1 Month ago
See:

www.suneido.com/index.php?option=com_fir...=871&catid=3#871

and Zippy's post that it refers to:

www.suneido.com/index.php?option=com_fir...=559&catid=5#559

This comes up regularly. I should probably add a note to the Master-Detail page.

Post edited by: andrew, at: 2007/07/11 01:36
 
 
Last Edit: 2008/02/20 17:38 By sunadmin.
 
andrew
 
#955
Re:Browse in Access 3 Years, 1 Month ago
The solution works nicely. Thanks.

This comes up regularly. I should probably add a note to the Master-Detail page

A note in the manual may not be enough. I would suggest an example where there are not so many things with the same name ;)

Here is the code I setlled on. Note the use of the FormControl (from a post by jennebelle) to get the fields to line up.
Code:


Controller
{
Controls:
(Access
title: "Enter Lot Data"
lots
(Vert
(Form
(lotNumber group:0)(planName group:1)  (streetAddress group:2) (streetName group:3) nl
(purchasePrice group:0) (upgradesCost group:1) (totalCost group: 2) nl
(lastName1 group:0) (firstName1 group:1) (lastName2 group:2) (firstName2 group:3) nl nl nl
(homePhone group:0) nl
(cellPhone1 group:0) (cellPhone2 group:2) nl
(email1 group:0) (email2 group:2) nl
)
(Skip)
(Browse
"sales",
columns: (saleDate, saleAmount, saleSource, saleNote)
linkField: lotNumber,
name: "lotNumberMain"
)
)
)
}




And the rule...

Code:


Rule_lotNumberMain

function()
{
return .lotNumber
}



Post edited by: peaslee, at: 2007/07/11 18:44

Post edited by: peaslee, at: 2007/07/11 18:44