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

Home Posts Topics Members FAQ

Form / Subform Problems loading Data

nic
Hi

I am currently having problems getting two forms to behave the way I
want. I have two tables Student and Application, and their respective
forms. (Tables)Student has StudentID (PK) & an ApplicationID. And
Application has ApplicationID as its primary key.

With the main Form being the Student_Details form, I have a Button
which loads the Application Form. The way I want it to behave is when
the Load_AppForm button is clicked the following occurs; if an
applicationID exists in the student table then it loads the relevant
Application Details in the Application_Det ails form. Otherwise if the
Student table has no ApplicationID (ie, currently null, a new student)
then the Application Form will load to a new record, and then when all
data has been inputted here the ApplicationID is passed back to the
Student_Details form, and hence saved in the Student Table.

The following VB code within the Load_AppForm_Bu tton_Click routine
doesn't quite work...and know that I will also need code behind the
Application Form as well.

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Application_De tails"

If Not IsNull([Forms]![Student_Details]![S_ApplicationID _txt])
Then
stLinkCriteria =
"[Forms]![Student_Details]![S_ApplicationID _txt]=" &
Me![ApplicationID_t xt]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Else
DoCmd.OpenForm "Application_De tails"
End If

Any advise would be greatly appreciated.

Thanks nic
Nov 12 '05 #1
2 1752
Nic,

I don't want to be rude, but if there is a 1:1 relation between a student
and an application, why don't you create a single table which contains all
data? If you don't have to split a table don't.
Another solution might be to keep the student form and to drag a
subform-control into it which has to refer to the application form. This
will handle the relational issues automatically. One major drawback is that
you have make some adjustments in both tables. You have to drop the
ApplicationID attribute in the student-table and add the StudentID attribute
to the application-table. Before you go any further, I think it is a good
idea to take a closer look at the subform-control documentation. This
control offers a lot of advantages in cases like this but it will take some
time to understand what it is doing.

Good luck!

"nic" <ni*******@yaho o.co.uk> schreef in bericht
news:aa******** *************** ***@posting.goo gle.com...
Hi

I am currently having problems getting two forms to behave the way I
want. I have two tables Student and Application, and their respective
forms. (Tables)Student has StudentID (PK) & an ApplicationID. And
Application has ApplicationID as its primary key.

With the main Form being the Student_Details form, I have a Button
which loads the Application Form. The way I want it to behave is when
the Load_AppForm button is clicked the following occurs; if an
applicationID exists in the student table then it loads the relevant
Application Details in the Application_Det ails form. Otherwise if the
Student table has no ApplicationID (ie, currently null, a new student)
then the Application Form will load to a new record, and then when all
data has been inputted here the ApplicationID is passed back to the
Student_Details form, and hence saved in the Student Table.

The following VB code within the Load_AppForm_Bu tton_Click routine
doesn't quite work...and know that I will also need code behind the
Application Form as well.

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Application_De tails"

If Not IsNull([Forms]![Student_Details]![S_ApplicationID _txt])
Then
stLinkCriteria =
"[Forms]![Student_Details]![S_ApplicationID _txt]=" &
Me![ApplicationID_t xt]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Else
DoCmd.OpenForm "Application_De tails"
End If

Any advise would be greatly appreciated.

Thanks nic

Nov 12 '05 #2
Thanks for your comments. I originally started out with StudentID in
the application table. Turns out it would have been too much of a head
ache the way I was going. I am still going to keep the 2 tables, I know
that I don't have to, but I will. Almost have it sussed, but should I
have further problems, the you may see another posting.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3058
by: Max Harvey | last post by:
Hi, I made up a nice little form which had its own sub form in it. I made a litle VB code so that when I pressed a button it would move form the form (frmConference) to the subform (frmBookingBookingBased), start a new record, and copy some values form the form into some fields in the subform, and then leave the cursor sitting (in focus) at the begining of the subform.
1
2197
by: Jim | last post by:
I have this chart on a form. I'm trying to get this chart to render only if the user chooses to do so. This because of that the chart is quite complex and takes some time to render. I know that I probably should put it on a report and call that report from the form but for various reasons I need the chart on this form. In a table bound to this form I have a Yes/No field and then from a checkbox the user should get to choose if the form is...
4
4689
by: Paul | last post by:
I have a basic form. On it are two sub forms. The top sub form has a list of records. When a user clicks on a new row within the top sub form. I want the RecordSource of the bottom sub form to change according to some data in the row of the top sub form. Main Form Name: Form1 Top Sub Form Name: frmT1_Datasheet Bottom Sub Form Name: frmT2_Datasheet The code in frmT1_Datasheet is:
4
3654
by: Krzysztof Bartosiewicz | last post by:
Hi! I haven't been using Access for a very long time and I forgot everything :) I will be very greatful for help since I have been fighting with this problem for a few hours... I have three tables: Medicines (ID_Medicine, ID_MedicineGroup, MedicineName), MedicineGroups (ID_MedicineGroup, MedicineGroupName) and Treatment (ID_MEDICINE, ID_CONSULT, ID_COMMENT). After the user chooses appropraite MedicineGroup and later Medicine from...
9
2748
by: PC Datasheet | last post by:
I'm stuck on something that seems should be easy and I need some help. My main form has an option group with five options. My subform chooses from different lists depending on which option is selected in the main form. I thought all I had to do for the subform was create a query and set the criteria equal to the option group value in the main form. No way, Jose! When the form/subform opens, the option group value is not available to the...
4
8508
by: crystal | last post by:
I've checked the threads but haven't been able to come up with a solution to my issue. Help...... I have a simple form based on a table. Within the form is a subform that is also, through a Q, based on the same table. The code: Private Sub Select_BeforeUpdate(Cancel As Integer) On Error GoTo resetselect_Err
11
3002
by: Rik | last post by:
Hello guys, now that I'm that I'm working on my first major 'open' forms (with uncontrolled users I mean, not a secure backend-interface), I'd like to add a lot of possibilities to check wether certain fields match certain criteria, and inform the user in different ways when the data is wrong (offcourse, this will be checked on posting the data again, but that's something I've got a lot of experience with). Now, offcourse it's...
11
7178
by: mrowe | last post by:
I am using Access 2003. (I am also using ADO in the vast majority of my code. I recently read a post that indicated that ADO is not all that is was initially cracked up to be. In the back of my mind I am wonder if this is causing my problem, but I don’t want to go through the work to convert to DAO unless I know it is truly in my best interest.) I am having problems getting a requery to show up consistently on a couple of forms. I have...
0
1710
sickenhoofer
by: sickenhoofer | last post by:
I am having some problems with a form and its subforms. It was designed to click on a list of numbers on a subform, which causes another subform's data to change to data relevant to the number selected. Attached are 2 pictures: 1. snapshot of master form w both subforms; 2. snapshot of relationships for tables involved in problem. Here is the main set up info: Table 1 = tblProviderMain ProviderMainID (PK - autonum) Table 2 =...
0
9679
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10453
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
10223
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
10003
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
9050
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
7546
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
6785
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5573
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4115
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

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.