I have a database that I am using to store student data. There are two tables and two forms to display the data: Tables
tbStudent
tbRE Forms
fmStudent
fmRE
tbStudent stores basic student data, while tbRE stores specific academic data for some, but not all, students. The two tables are linked through the student ID number(stStuID), which is the key in tbStudent.
I would like to create a command button in fmStudent that opens fmRE, but to the record of the student currently displayed in fmStudent. Aside from opening fmRE to a specific record, I am also curious about what happens if a student does not have a record in fmRE. Could I have the command open fmRE to a blank record if the student doesn't have a record, so the user can enter the data to create one?
I have not used VBA very much so I am new to this level of design. I've seen some responses to this type of question, but I'm not sure how to get started with the coding.
I am using Access 2003 on Windows XP.
Thanks!
3 27258
The easiest way to do this is to use a subform on your form that is the fmRE. Bind it using the stStuID field. This will display the records for students who have them and a blank record where there is no record available.
If you try to open another form you will have problems with the ones that haven't any records. For future reference the code would be:
DoCmd.OpenForm "fmRE", , , "[stStuID]=" & Me.stStuID
I have a database that I am using to store student data. There are two tables and two forms to display the data: Tables
tbStudent
tbRE Forms
fmStudent
fmRE
tbStudent stores basic student data, while tbRE stores specific academic data for some, but not all, students. The two tables are linked through the student ID number(stStuID), which is the key in tbStudent.
I would like to create a command button in fmStudent that opens fmRE, but to the record of the student currently displayed in fmStudent. Aside from opening fmRE to a specific record, I am also curious about what happens if a student does not have a record in fmRE. Could I have the command open fmRE to a blank record if the student doesn't have a record, so the user can enter the data to create one?
I have not used VBA very much so I am new to this level of design. I've seen some responses to this type of question, but I'm not sure how to get started with the coding.
I am using Access 2003 on Windows XP.
Thanks!
NeoPa 32,556
Expert Mod 16PB
DoCmd.OpenForm "fmRE", , , "[stStuID]=" & Me.stStuID
Or if, as I suspect, the st of stStuID stands for string, then you must add quotes around the variable in your code thus : - DoCmd.OpenForm "fmRE", , , "[stStuID]='" & Me.stStuID & "'"
Or if, as I suspect, the st of stStuID stands for string, then you must add quotes around the variable in your code thus : - DoCmd.OpenForm "fmRE", , , "[stStuID]='" & Me.stStuID & "'"
Good call.
I just assumed that ID would be a number. I have to stop doing that.
Mary
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Robin S. |
last post by:
More clueless newbie questions...
Table 1: "available specs"
Table 2: "classes"
A single form shows a single record from the table "classes". Each record in
"classes" may contain several...
|
by: amywolfie |
last post by:
I've been trying to do something for about 3 days – I get close, but
not 100%.
I am trying to:
Open frmRevisionHistory from a button on frmFeeInput.
If there is NO RELATED RECORD, then I...
|
by: allyn44 |
last post by:
Hello,
I have built a serch form for users to edit records. I only want them
to pull up the record they need, and I want to check for nulls. There
should not be dupes becasue the underlying...
|
by: Cagey |
last post by:
What I'm trying for: If this selection or if click on selection
(highlighted line choice/
which ever selection change) w/in query's combo dropdown list box (on
Switchboard),
then Open in...
|
by: piscogirl |
last post by:
Hi all,
Here's my case:
I have a form: Event Form
and a subform: AttendanceSubForm
The user selects a name (from a Person Table) on the subform to
register for the event. If the name is...
|
by: Leah Trahan |
last post by:
I am new at Access, databases, AND posting threads (sorry). I have a subform that is a continuous form based on a tabular query. I enter a particular serial # (on the main form) and the subform...
|
by: kev |
last post by:
Hi folks,
I have a form for registration (frmRegistration) whereby i have two
buttons. One is Save which saves record using the OnClick property. I
used wizard to create the save button. The...
|
by: reginaldmerritt |
last post by:
Hi,
I'm using the following code to open a form on a specific record. I have a form displaying records in a list which then allows users to click onto the record to open it up in a new form in a...
|
by: Adam Tippelt |
last post by:
I've got a form that allows users to "save the current record to drafts" if they haven't finished writing all the data for that record. This saves it in it's current state, which puts it in a...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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...
|
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,...
|
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...
|
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...
|
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...
| |