473,796 Members | 2,680 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Automatically fill fields

48 New Member
hi there,

I am trying to find a way to link three fields in a form together. For example, if the User chooses CostCenter, then automatically the fields OrgUnit and Region receive a value (CostCenter=000 11, Region=US, OrgUnit=Archite ctur)

I have tried to solve the problem with: [CostCenter] in the fields Region and OrgUnit. Because I have added columns to the CostCenter Table. However, what I am getting is just the CostCenterID number, so doesn't work.

Is the way I am approaching the only possible one? or is there a SQL-WHERE possibility, or even a macro. Does anybody have an idea?

Best Regards,

Alive
Aug 2 '07
18 2160
NeoPa
32,579 Recognized Expert Moderator MVP
When discussing queries it's best (certainly easiest) to post the underlying SQL. I doubt you'll manage to send screenshots via PM anyway.
BTW Nice work Damon, your new status is in hand ;)
Aug 2 '07 #11
alive84
48 New Member
@NeoPa:

Your are certainly right with both matters! :-)

@Damon

I have tried the one you gave me, didn't work. So I have tried to build another one, but this one is kind of messy, but my logic (which must be wrong) tells me this:

Expand|Select|Wrap|Line Numbers
  1. SELECT Work.CostCenter, Work.OrgUnit, Work.Region, CostCenter.CostCenter, CostCenter.OrgUnit, CostCenter.Region
  2. FROM CostCenter INNER JOIN [Work] ON (CostCenter.Region = Work.Region) AND (CostCenter.OrgUnit = Work.OrgUnit);
But what Access gives me in the Form is ?Name, great error message.

Thanks to you both
Aug 2 '07 #12
NeoPa
32,579 Recognized Expert Moderator MVP
Alive,
Can you do either :
  1. Provide a picture of the error.
  2. Describe it with everything that appears - the title; the msg; etc
I think there may be something missing from the message. It doesn't seem to fit the SQL posted.
Aug 2 '07 #13
alive84
48 New Member
Hi NeoPa,

Ok, I will try to visualize it.

I create the following query in the SQL-Builder of Access:

Expand|Select|Wrap|Line Numbers
  1. SELECT CostCenter.[CostCenterID], CostCenter.[OrgUnit, Region], [Work].WorkID, [Work].[OrgUnit], [Work].[Region]
  2. FROM [Work] RIGHT JOIN CostCenter ON [CostCenter].CostCenterID =CostCenter.Work;
While I try to save it, I receive the error message: Join Expression Not Supported

So I am changing the RIGHT JOIN, with an INNER JOIN.

Same Error, but Access highlights [CostCenter].CostCenterID =CostCenter.Wor k .

So, something must be wrong here, but I ve tried to do follow Damon's advices.

So, I am lost...

Thanks
Aug 3 '07 #14
NeoPa
32,579 Recognized Expert Moderator MVP
That's because the ON part of the FROM clause should be saying :
Expand|Select|Wrap|Line Numbers
  1. [CostCenter].CostCenterID=[Work].CCFieldName
(where CCFieldnName is the name of the CostCentre field within your [Work] table) instead of
Expand|Select|Wrap|Line Numbers
  1. [CostCenter].CostCenterID =CostCenter.Work
Aug 3 '07 #15
NeoPa
32,579 Recognized Expert Moderator MVP
So, assuming that your [Work] table has the field called [CostCenterID], your SQL would be :
Expand|Select|Wrap|Line Numbers
  1. SELECT CostCenter.[CostCenterID], CostCenter.[OrgUnit, Region], [Work].WorkID, [Work].[OrgUnit], [Work].[Region]
  2. FROM CostCenter INNER JOIN [Work] ON CostCenter.CostCenterID=Work.CostCenterID
unless of course, CostCenter.[OrgUnit, Region] is a typo. In which case try :
Expand|Select|Wrap|Line Numbers
  1. SELECT CostCenter.[CostCenterID], CostCenter.[OrgUnit], CostCenter.[Region], [Work].WorkID, [Work].[OrgUnit], [Work].[Region]
  2. FROM CostCenter INNER JOIN [Work] ON CostCenter.CostCenterID=Work.CostCenterID
Aug 3 '07 #16
alive84
48 New Member
Thanks for the answer.

I do not know what is wrong with me and my AccessDatabase. When I try it, I still get that stupid and frustrating error message in my form: #?Name.

I finally understand the SQL queries you guys were giving me, but somehow it still wont work at all.

When I am linking the query to the form field, is the following approach right?

1. I type the SQL-Query in the Access SQL-View. Save it
2. Go to my form Work and add the Query to the OrgUnit field --> ... --> Queries --> choose OrgUnit --> hit value --> Ok.
3. Save the Form and switch the view.

That's the right approach, no?

Thanks for the patience and of course the help you all are providing.
Aug 6 '07 #17
NeoPa
32,579 Recognized Expert Moderator MVP
You've just described your [Work] object as a form rather than as a table. If that is true you should clarify that. We've been working under the delusion that it's a table.
Aug 6 '07 #18
alive84
48 New Member
ok....I have a form and a table Work.

sorry for the confusion.
Aug 7 '07 #19

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

Similar topics

3
3820
by: paul b | last post by:
Hello, I have a small problem in PHP an perhaps someone can help me: I have a simple HTML login page with a username and a password field, as well as a submit button, which I have to use for login(I cannot simply replace it by a php-page :-(). is it possible to call this page via a hyperlink from a php-script and to directly fill the username and password fields as well to raise the event of clicking the submit button.
8
2243
by: netsurfer | last post by:
Hi: Have a question on making the date automatically filled in by what the user enters in by the date at the top. The date entered at the top would most likely be on a Wednesday then I need to have all the prior dates pop in. Example: User enters 2/9/05 in the date field at the top being a Wednesday...I need the dates at the bottom to be filled in automatically, respectively as 2/3/05, 2/4/05, 2/5/05, 2/6/05, 2/7/05, 2/8/05, 2/9/05...
1
3058
by: Charles Robinson III | last post by:
When selecting a option from a drop down menu in the form view, which is linked to a table with three columns, how do I get Access to automatically fill in two other fields automatically once the first field is selected, and by using the remaining two columns?
0
1327
by: Aravind | last post by:
Hi folks. I have the following tables (PK = primary key, FK = foreign key): Member (MemNo , MemName, MemType, Course/Faculty) History (..., MemNo , ...) Member and History are linked in a 1 (Member) to Many (History) relationship. I have a form (frmHistory) based on a query (qryHistory) which is based on these tables.
7
2241
by: jballard | last post by:
Hello, I have a database set-up with a form and two subforms in it. I have one of the subforms (replacement parts) set-up where you can pick part numbers from a drop down box and also pick a description of the part from a drop down box. These are two separate fields. I want to be able to pick the part number and have it put in the description automatically or the other way around. Which ever would by easier?
2
2220
by: DP | last post by:
hi, i have created a video rental database system. i have created a customer form, and a film form. i related all the tables, with; tblCustomer has membershipID, which is primary and autonumber, tblFilm has FilmID, which is primary and autonumber, tblFilmRental , which has RentalID, CsutomerID, and FilmID
1
408
by: moorebj | last post by:
I am having trouble writing a SELECT query. I have a "Customer" table with "Customer Name", "Street Address" and "Suburb, State, Post Code" fields. On a form I would like to be able to enter in the "Customer Name" and automatically fill in the "Street Address" and "Suburb, State, Post Code" fields from this table. All of the fields on the form are COMBO boxes. Any help would be greatly appreciated.
4
2347
by: JA | last post by:
Not exactly sure how to explain this. I have 4 fields (in access 2000). Category, Catid, Subcat, subcatid. There are 40 categories, and about 1500 subcats. I've added the categories to the lookup, so when I enter them in the field, I can usually just type the first letter or two. (they are in a dropdown box). I would like to have the CatID show up automatically in it's field, after I
1
2466
by: cclayton000 | last post by:
Does anyone have a basic example of a script that can automatically fill fields in a subform? Here is the scenario: I have a main form for a Sample Lot and I have added some side-fields (not bound to any table) that asks basic information: Number of Samples (x), Quantity, Unit of Measure, Location, Tray...I would then like a button that triggers a script to automatically create the Sample Details (subform) that is autonumbered and then...
1
2203
by: pctec | last post by:
Hello, I have a combo box that is looking into a field from a table named Machines, this machine table has two columns; MachineName and MachineRate but the Combo Box it only showing the MachineName field. What I want is to fill a different table with the MachineRate as soon as I select the MachineName. I’m already storing the MachineName with the Combo Box to table1 but need to extract automatically the MachineRate into a table1 as I select...
0
9535
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
10465
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10242
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...
0
10021
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9061
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
7558
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
5453
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
5582
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2931
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.