473,657 Members | 2,414 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Populate FK field of one table based on search results from continuous form

3 New Member
Hi,

I am new to this DB caper and am really struggling.

I have a form called customers with a subform called property search. The subform (a continuous form) allows users to search the table 'property' using multiple criteria (postcode, house num etc) and returns a set of matching results.

I want to be able automatically populate the a field called LPI (a unquie property ref which is the PK of table property and FK of table customers) on the customers form based on selecting a property address from the search results on the subform. Either by dbl click or a command button.

Can anyone help

Thanks
Nov 1 '07 #1
5 2079
nico5038
3,080 Recognized Expert Specialist
You can use the OnCurrent event of the subform to change the value of a field on the masterform like:
Expand|Select|Wrap|Line Numbers
  1. Parent.LPI = Me.LPI
  2.  
I do however wonder what you want to do when a customer has two properties...

Nic;o)
Nov 3 '07 #2
Desmond Shek
3 New Member
Thanks Nico,

I can see how this would work in a 'normal case' but its not quite what I'm after. The problem is that my forms are unbound - no parent/child relationship -because if I establish that then the search funtion in the subform does not work (don't know why). Sorry, I have probably gone about this the wrong way.

To recap what I am trying to do...

The subform is a continuous form linked to a table called "property" and has the facility to search on either postcode, housenumber of a combination. For e.g. if I put 8 into the house number field and search I get 3 records returned in the detail section matching this criteria. On selection of one of these records, by clicking the record select area, I want to populate the field LPI in the main 'Customers' form and update the underlying field LPI in the "Customers" table

I am not sure if it is now possible the way I have set it up..?

Desmond Shek
Nov 5 '07 #3
nico5038
3,080 Recognized Expert Specialist
Hmm, still no answer to the question or a Customer can be related to multiple properties.
Let's assume that that's a requirement. Then you can imagine that the Customer -> Property relation is like an Order -> OrderDetails relation.
For an order you'll allow the user to add orderdetails in a subform, so your user could have a subform to add a property (or properties).
Additionally you have a requirement to select the properties in a flexible manner.
This can be achieved by offering a separate "Property Select" form. This can show the properties in a datasheet (sub) form and after selection pass the Property ID to the "PropertyDetail " of the customer window.

For the selectio you can instruct the user to use the right-click popup menu as described in:
http://www.geocities.com/nico5038/xR...nstruction.zip

Getting the idea ?

Nic;o)
Nov 5 '07 #4
Desmond Shek
3 New Member
Hi, I am starting to get this - sorry for being slow. It appears from what you say that I have to have my property search form as a seperate form (possibly with a button on the customers form to open it) and then pass the Property ID (and other details) to the Customer form. However the key thing I still don't understand is how I pass the Property ID from one form to another. Property ID is a key field that links many of my tables and I will have to do this on other forms I am building

To answer your question, yes there is a slim chance that a customer has more than one property but in terms of a property's history it can also have more than one customer. So it is potentially a many to many relationship. I guess I will have to split customers into 2 tables,

Tbl Customers - Name, contact details etc - ONE - CUST_ID PK
Tbl CustPropert - Details of property - MANY - CUST_ID FK
- PROPERTY ID FK (links with tbl Properties)

I should mention the Property DB is something I recieve from seperate organisation and is list of all properties in a Local Authority area each with a unqiue Property ID. For our work a customers property must be found in this property DB or we will not deal with it.

Confused? I think I am..!

DS
Nov 6 '07 #5
nico5038
3,080 Recognized Expert Specialist
Hmm, still no answer or one customer can have two (or more) properties or a property two or more owners. When that's the case, then three tables are needed:
tblCustomer
tblProperty
tblRelationCust Prop
The last one is know as a relation table and will hold the ID's of both tables.
This will allow a property to have multiple owners or an owner to have multiple properties.

Assuming a property has to be linked to one owner, you can best use a Property mainform and a Customer subform.
By filtering the Properties without a customer you can get your "To do" list.
By selecting the proper customer from the subform you can use a button [Link Customer] to fill the value of the current subform into the mainform's CustomerID like:
Expand|Select|Wrap|Line Numbers
  1. Me.CustomerID = Me.subformname.form.CustomerID
  2.  
Nic;o)
Nov 6 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
6305
by: Damian | last post by:
Hi. Is there a way to programatically populate a continuous form? I have an array of descriptions that I want to display in the continuous form and I have a textbox on the form called 'txtDescription' I can populate the text box using this code: Me.txtDescription.Value = myArray(1) Trouble is, I can't figure out how to get more than 1 row to display
3
579
by: John young | last post by:
I have been looking for an answer to a problem and have found this group and hope you can assist . I have been re doing a data base I have made for a car club I am with and have been trying to make a query that selects from a table as desribed below .. I have a table (Volunteer) that has a member field (memnumber) and a number of fields that are headed in various categories and are yes/no formated
11
9139
by: Pete | last post by:
Is there any way to change the default search to "Any Part Of Field" instead of whole field? The first thing I ever do when searching for something in a field is change the default setting from "Whole Field" to "Any part of field" because that way I don't have to key in the entire word I'm searching for. It is especially frustrating having to explain this to all of the people using my database. Any help would be appreciated. Thanks.
3
2589
by: Chris | last post by:
Before I started to create table, etc to track unique form field record number assigments I thought I'd check to see if there is now a better way to do this in .NET. I have a parent form (table) and children form (table). Relationship equals one to many. I'd like to auto number the fields accordingly and traditionaly I assign a unique number based on a table value that I retrieve + 1. i.e. Parent record field value = 1 Children record...
5
5902
by: Rich | last post by:
Hello, I have a search application to search data in tables in a database (3 sql server tables). I populate 2 comboboxes with with data from each table. One combobox will contain unique CompanyID's. The second combobox will contain unique memberID's. Each of the tables that I have to search contain a CompanyID and a memberID field, and these fields are not unique in the respective tables. Like CompanyID, MemberID
9
9682
by: Ecohouse | last post by:
I have a main form with two subforms. The first subform has the child link to the main form identity key. subform1 - Master Field: SK Child Field: TrainingMasterSK The second subform has a master-child link to the first subform. subform2 - Master Field: subTrainingModule.Form!TrainingModuleTopicSK Child Field: TrainingModuleTopicSK
5
17677
by: joshua.nicholes | last post by:
I have an access database that consists of two tables.A data collection table and a species list table. The data collection table has about 1500 records in it and the species list has about 600. The species list has 7 fields the first is a four digit unique identifier (species) it is set as the primary key. I have created a relationship to the data collection table which also has a species field (4 digit id). In my form I have the species...
5
3913
FOE2272
by: FOE2272 | last post by:
I have tried every option that I can think of and most of them on this forum. The closest that I got was to bring up the field but it changed the other records based on what was chosen in one record. Details: DB with one main table and several list (reference) tables. I want to populate several list boxes on one form based on a choice from a combo box. Example: Tables:
4
13953
by: whamo | last post by:
I have the need to populate a field based on the selection in a combo box. Starting out simple. (2) tables tbl_OSE_Info and tbl_Input; tbl_OSE_Info has three fields: Key, OSE_Name and OSE_Wt tbl_Input has three fields: OSE_Job, OSE_Name, OSE_Wt I have populated tbl_OSE_Info table. I need to create a form that will store the data in tbl_Input I have racked my brain so much trying to figure out how to auto populate a field based on a...
0
8315
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8734
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8508
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7341
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6172
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4164
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4323
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2733
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1627
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.