473,498 Members | 1,074 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Opening of subforms

76 New Member
Hi.

I would like to do the following. This is what I have

Table - Operators with the following fields
Operator (Primary key)
Username
Password

Table - OperatorDetails with fields
Operator (Prim Key)
FirstName
LastName etc...

There is a one-to-one relationship between the 2 tables above.

I have a form called - AddOperator
On this form I have a button called "Edit operator details". When I click on the button I want it to open another form called "OperatorDetails", but must be linked to the current operator on the form "AddOperator".

E.g. In Form "AddOperator", field Operator I have BRENDA.
So when BRENDA is in that field and I click on the "Edit operator details", then the "OperatorDetails" must open with BRENDA already filled in in the field "Operator".
This would help me if I do a query that i can link all the ddetails between the two tables.

Any suggestions is very welcome,

Thanks
Ryno
Nov 26 '10 #1
3 1222
mshmyob
904 Recognized Expert Contributor
I keep looking at your table design and keep scratching my head.

First the two tables are not related to each other since you have no foreign key. But more importantly why would you create two tables for this so called 1-1 relationship.

If you have an Operator table and each "operator" is only allowed one username/passowrd then all your data (ie: first/last name, username/password, etc.) should be contained in a single table.

Maybe I am missing something here because you have not given enough info but my suggestion is that you combine into a single table and if you feel so inclined, you should read up on normalization.

Like I said I may be missing something and if I am please enlighten me and I may be able to help better.

cheers,
Nov 26 '10 #2
Ryno Bower
76 New Member
OK, i followd your instruction, to keep it all in one table. I have done that.

This is what I have now.

Table: Operators
Fields: Operator(Primary Key), Username, FirstName etc
Forms: AddOperators, OperatorDetails

In form "AddOperators" I have fields to to add a new operator along with the username and password. On this form I have a button "Edit Details"

When I click on the button, I want the form "OperatorDetails" to open baed on the details I just filled in on form "AddOperators".

E.g.
On "AddOperators" field "Operator(Prim Key) I have ESTVEN, so when form "OperatorDetails" opens it must open so that I can fill in the details for that specific record just filled in in form "AddOperators"

I have tried many different methods but t doesn't work properly. If someone can provide me with a code which can do the above explanation, I would be so happy.

Thank you!
Nov 26 '10 #3
mshmyob
904 Recognized Expert Contributor
Ryno, I think you are over complicating this issue. Since the data you need to add/edit is in a single table you just need a single form that is bound to that table to accomplish everything you want to do.

The simplest way might be to add a button to add a new operator otherwise you are in edit mode.

Code for the add/new button click event is as simple as:

Expand|Select|Wrap|Line Numbers
  1. DoCmd.GoToRecord , , acNewRec
  2.  
This will put you in append mode and allow you to add a new operator.

Otherwise just use the navigation buttons to scroll through existing records and edit them when you need to.

If you really need to open a new form then open the form with the openargs flag like so:

Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenForm "YourDetailFormName", , , , acFormEdit, , OperatorID
  2.  
In the ON Open event of the detail form you grab that passed variable as so:

Expand|Select|Wrap|Line Numbers
  1. Dim txtOperatorID as String
  2. ' assign the passed variable to your variable above
  3. txtOperatorID = Me.OpenArgs
  4. ' assign the passed variable to the control on your form
  5. Me.txtMyOperatorID = txtOperatorID
  6.  
But like I said I don't believe you really need the second form.

cheers,
Nov 26 '10 #4

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

Similar topics

0
2224
by: Jack | last post by:
Gday everyone, I'm dearly hoping Stephen Lebans is going to update his masterpeice to stop the mouse wheel scrolling to work on subforms *he has indicated this to me but of course beggers can't...
5
9843
by: Lyn | last post by:
Hi, this has been driving me nuts. I'm on Office 2003 SP1, Win XP SP1. I am opening a form with a number of subforms based on various tables. The subforms are populated via the main form's...
4
3725
by: microb0x | last post by:
I have an application with a master form with a tab control containing nine tabs, each tab contains a subform. I have command buttons on my main form including: Save , Cancel , Close. My...
1
1341
by: CanuckChuck | last post by:
Hello, This question may sound too general and confusing but I am trying to keep it simple. I have a form that managers log into to view a list of the employees reporting to them. They are...
3
1483
by: birt | last post by:
I have a form with two subforms on it. On my 2nd subform I want to open a new form base on three criteria. One is a string two are integer. It has been over six years since I have done this and I...
7
4955
by: Edwin Martinez | last post by:
Hello I have a parent form but I want to create 4 forms that will be shown in a area inside the parent form when I click to buttons. +----------------------------+ | Parent Form ...
3
2099
by: BASSPU03 | last post by:
My "View All Resources" code is no longer fully suitable for its respective DB form. Now it's not a matter of just opening one form and making it read-only. Now I have a main form with three...
21
3284
by: Dan Tallent | last post by:
In my application I have a form (Customer) that I want to be able to open multiple copies at once. Within this form I have other forms that can be opened. Example: ZipCode. When the user enters...
8
11620
by: Steffen Beck | last post by:
Hi NG I need some help with a problem on my forms. If I have 2 related tables, for instance companies and employees, and want to display all companies on a continuous form with their...
31
6622
by: matthewslyman | last post by:
I have an unusual design and some very unusual issues with my code... I have forced Access to cooperate on everything except one issue - record deletion. My form design involves a recursively...
0
6998
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...
1
6884
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...
0
7375
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
5460
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
4586
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3090
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...
0
1416
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 ...
1
651
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
287
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...

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.