473,386 Members | 1,647 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Autofill of a field based on another

Hi there - thank you in advance - up front - I am a newbie at Access.

I have built a basic database for a Field Researcher documenting weeds.

Problem: I want to auto fill fields based on the another:

Details:
Table 1:Names
ID: Primary Key
Weed Scientific Name
Weed Common Name

Table 2:Names
ID:Primary Key
Weed ID: Foreign Key
Collection place
Date
Field 5
Field 6
etc

One Form with combination of above.

The user needs to select the Weed Scientific Name on the form - and have the Weed Common Name autofill.

OR vice versa - select the Weed Common Name and have the Weed Scientific Name auto fill.

I have worked out that it probably requires Combobox and something to do with the foreign key and after update code. ...but that's where I end. I'm just not sure what to do!!

Please help me! Thank you so much in advance.
Jul 12 '10 #1
4 6089
Delerna
1,134 Expert 1GB
More detail

I will hazard a guess based on what you have posted
I would probably

Create a query for my form
Expand|Select|Wrap|Line Numbers
  1. SELECT Table2.ID,[Weed ID],
  2.    [Scientific Name],
  3.    [Common Name],
  4.    [Collection place],
  5.    {Date]  ... etc
  6. FROM Table2
  7. JOIN Table1 on Table2.[Weed ID]=Table1.ID
  8.  
Then I would let the query wizard create a columnar form bound to that query. Could also use a continuous form.

I would then design that form and add a combobox with the following query as its datasource
Expand|Select|Wrap|Line Numbers
  1.   SELECT ID,[Scientific Name] & " (" & [Common Name] & ")" FROM Table1
  2.  
I would also ensure that the ID field in the combobox was bound to the [Weed ID] field on the form.

I would also probably put
Expand|Select|Wrap|Line Numbers
  1.    me.refresh
  2.  
into the after update event of the combobox.

Anyway, something along those lines should work for you.
It's difficult to give an exact answer because
1) You don't have enough detail.
2) I don't have the DB in front of me.
Jul 12 '10 #2
Delerna
1,134 Expert 1GB
You could alternatively use 2 comboboxes
with
Expand|Select|Wrap|Line Numbers
  1.  SELECT ID,[Scientific Name] FROM Table1
  2.  
for the data source for the scientific name combo

and

Expand|Select|Wrap|Line Numbers
  1.  SELECT ID,[Common Name] FROM Table1
  2.  
for the data source for the common name combo

Both combo's would need their ID field's bound to the [Weed ID] field of the form

and both combo's would need the same after update event
Jul 12 '10 #3
Hi Delerna,
Thank you very much for repling. Should I send you the database to have a look -would you be happy to do have a look

Cheers
Jul 12 '10 #4
Delerna
1,134 Expert 1GB
well.... you can, but it would be better for you if you had a stab at it first.
Jul 12 '10 #5

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

Similar topics

1
by: Tony Johnson | last post by:
I want to update a particular field in a form for only a certain set of records. The certain set of records is named Financed. I need to update those Financed records with a financed number that...
6
by: Carlos | last post by:
Hi all, I am trying to access a public field of another form class within the same namespace. The field is public, what is the best way to access it from a different class? I defined as private...
14
by: SpyderSL | last post by:
Hey, I have created an access form, in which I have a drop down with employee names. These are the steps I would like to happen: 1. A user will enter a number in FIELD A 2. The user will...
1
by: abprules | last post by:
Can somebody help me with this scenario? I want to update a date field when another field has a certain value entered. It is something like this: When the PDetType field ( from tlkpERegStatus...
4
by: PRLIT | last post by:
First, let me just say that I've been looking at this site for help for awhile now. Thank you for all the help you given me over the past few months. Second, I'm creating a form in Access 2007. I...
1
by: Simon Gare | last post by:
Hi, have form on asp page with an email address field, when the user enters their email address I want it to populate another field automatically on the same page, some kind of OnBlur event....
1
by: compl | last post by:
I have a database that I need to restrict the ability to edit one field based on another. The two fields are DOS (date) and Amount (currency). I only want the users to be able to edit the Amount...
4
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...
5
by: Shortstuff12345 | last post by:
I'm trying to use VBA code to disable a field based on the value of another field in a form. The code I have properly updates the enabled property of the field when it changes; however, it changes...
11
by: clloyd | last post by:
I have a phone number field (BusinessPhone) that I only want to display in my query results if the user has selected yes (yes/no field) in another field (Business Y/N field). The premise is that...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.