473,416 Members | 1,546 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,416 software developers and data experts.

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_Details 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_Button_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_Details"

If Not IsNull([Forms]![Student_Details]![S_ApplicationID_txt])
Then
stLinkCriteria =
"[Forms]![Student_Details]![S_ApplicationID_txt]=" &
Me![ApplicationID_txt]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Else
DoCmd.OpenForm "Application_Details"
End If

Any advise would be greatly appreciated.

Thanks nic
Nov 12 '05 #1
2 1738
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*******@yahoo.co.uk> schreef in bericht
news:aa**************************@posting.google.c om...
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_Details 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_Button_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_Details"

If Not IsNull([Forms]![Student_Details]![S_ApplicationID_txt])
Then
stLinkCriteria =
"[Forms]![Student_Details]![S_ApplicationID_txt]=" &
Me![ApplicationID_txt]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Else
DoCmd.OpenForm "Application_Details"
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
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...
1
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...
4
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...
4
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...
9
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...
4
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,...
11
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...
11
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...
0
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...
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
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
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...
0
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
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.