473,406 Members | 2,954 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,406 software developers and data experts.

Can I have a form that will allow me which of 2 tables my inputs are for?Access 2010

OK. I have 2 tables with identical fields. One is called 'External Dies' and the other is 'Internal Dies'. Although the fields in the tables are identical, they have different relationships to another form, 'Product Codes'. The Internal has a one to one relationship to its 'Product Code', where as the External has a one to many relationship as it can be used with many Product Codes. Because of this, I assume I need a separate table for each. I would like a form that will give me a combobox that will give me 2 options: internal or external, then the corresponding table will be populated. Is this possible?

Its important to note, that although I am a Java Programming student, I have no VBA experience what so ever.
Mar 21 '12 #1

✓ answered by Mihail

This structure will allow you to change the row source to your form to any table:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Combo_Click
  2.     Select Case ComboValue
  3.         Case Value_1
  4.             Me.RowSource = "NameOfTable_1"
  5.         Case Value_2
  6.             Me.RowSource = "NameOfTable_2"
  7.         ..............
  8.         Case Value_n
  9.             Me.RowSource = "NameOfTable_n"
  10.     End Select
  11. End Sub
Note please that you can use this for queries too by replacing NameOfTable_n with NameOfQuery_n
Of course, in order to be able to change data or to add new records the query (queries) must be updatable.

This is pseudo code.
Not tested but should work.

9 1559
Rabbit
12,516 Expert Mod 8TB
It's certainly doable through code but wouldn't it be easier to just use different forms?
Mar 21 '12 #2
Hey Rabbit. I have it as 2 forms now. The reason I am asking is this pattern continues in other areas. Everything is split into 2 camps. Internal and External. If I could work how to do it once, I could then use the same technique in other forms.
Mar 21 '12 #3
Rabbit
12,516 Expert Mod 8TB
Well, after rereading the original post, I don't think you need two different tables.

Explain your data structure in more detail and we may find that it's not necessary to have different tables.
Mar 21 '12 #4
OK. I have a product code e.g 3115AA. This product code will have only one internal die (a die is used in the production process during printing) e.g DC6013. It will also have an external die e.g DC5092. The external die can be used with many other product codes where as the internal die has only one product code. Both dies 'revolutions' are updated after each use.
Mar 21 '12 #5
Rabbit
12,516 Expert Mod 8TB
Can you post some sample data from both internal and external?
Mar 21 '12 #6
I don't really know what to post. You can have a look at the relationships here:

http://imageshack.us/photo/my-images/15/capturezst.png/
Mar 21 '12 #7
Rabbit
12,516 Expert Mod 8TB
What I want you to post is data. Like this:
Expand|Select|Wrap|Line Numbers
  1. Table1
  2. Field1 Field2
  3. abc    1
  4. def    2
Mar 21 '12 #8
Mihail
759 512MB
This structure will allow you to change the row source to your form to any table:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Combo_Click
  2.     Select Case ComboValue
  3.         Case Value_1
  4.             Me.RowSource = "NameOfTable_1"
  5.         Case Value_2
  6.             Me.RowSource = "NameOfTable_2"
  7.         ..............
  8.         Case Value_n
  9.             Me.RowSource = "NameOfTable_n"
  10.     End Select
  11. End Sub
Note please that you can use this for queries too by replacing NameOfTable_n with NameOfQuery_n
Of course, in order to be able to change data or to add new records the query (queries) must be updatable.

This is pseudo code.
Not tested but should work.
Mar 22 '12 #9
NeoPa
32,556 Expert Mod 16PB
While Mihail's post may well answer the original question fairly well and clearly (and may even be the one to select as Best Answer), I would advise that you follow Rabbit's advice and proceed to look at your table structures (I'm fairly certain Internal and External data should be stored in the same table with a simple flag reflecting which type a record represents.) as a solution to your situation.
Mar 22 '12 #10

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

Similar topics

6
by: Max | last post by:
Hi, I have SqlServer 2000 as back end and Access 2000 as front-end. All tables from Sqlserver are linked to Access 2000. I am having write conflict problem with one of my form which is bound to...
2
by: IanCraft | last post by:
I am new to Access 2002 and have a questions regarding using a form for data entry. I have 15 items I need to keep track of that are listed individually on a form as follows: Item#1Name ...
3
by: pradeep | last post by:
Hi, I amnew to this group and lucky to have found this group. i have a master table which has different types of application say Desktop, Mainframes, etc. I have an individual table for each...
1
by: phill86 | last post by:
Hi, I have an access 2010 database that I want to convert to an SQL Server database and I need to know if the data macros in access will still work in the SQL database or will i have to create...
5
by: jaad | last post by:
Hello, I have a database that was written in access 2007 on my pc. I wanted to work off site with the database so I uploaded it onto my laptop which is loaded with access 2010 beta. When I...
2
by: sierra7 | last post by:
It seems Access 2010 is associating an 'input mask' or field type with a combo box when a form is opened, even though there is no Format setting on the control. I have a form which has been...
1
by: Alan Yim | last post by:
Hi folks, My company recently upgraded our Office suite from 2003 to 2010. The problem in particular is with an Access database that was originally designed in Access 2003. The code in question...
1
by: b wesenberg | last post by:
Good Morning, I am hoping that someone can assist me with a code problem. Here is the history of the issue. We had a database that was created in Access 2003 the database had a module in it...
2
by: Bill Boord | last post by:
I need to be able to shut off the AutoCorrect "feature" within Access 2010 code. I have utilized Application.SetOption with method strings for other startup requirements, but I cannot seem to find a...
1
by: Music Man | last post by:
Greetings All: I built a database in Microsoft SQL Server 2000 and used Microsoft Access 2010 as the front end. The database is used to keep track of "issues" that rise out of my employment. ...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
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...
0
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,...
0
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...

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.