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

Next record in one-to-many relationship?

I have inherited another developer's database (Access 2003) and with it
a problem I'm struggling with. The problem is this.

I have a parent-child form pair, which is populated by a table (the
parent) and a query (the child). The two sources are linked by an
identical unique number. The table populating the parent uses the number
as primary key. The child table has no primary key so it can used
one-to-many. Users add data through the form for a distinct financial
year end period (FYE).

When the child form loads, it brings in data for the first financial
year end period in the table without a primary key. The user wants to
work in the same form with data for each individual financial year end,
and so needs a command button which calls the next record for the unique
number presently loaded into the form (via a text box) by its next
financial year end, so they can work on data for each financial year.

What I need to do is code something for a command button that takes the
unique number (available through the .Text property of the textbox on
the child form, which is where the data gets added) and the FYE data
(available through a textbox property again), and construct a query that
gets the next record in the table using the number and FYE, and loads it
into the parent and child forms. I will also need a button that moves
them back in the opposite direction.

Help much appreciated, because I'm running out of time! :-)

Thanks.

Tony
Mar 3 '07 #1
1 2104
On Sat, 03 Mar 2007 19:28:39 GMT, Tony Dunn <to********@ntlworld.com>
wrote:

I don't understand.
"The child table has no primary key so it can used one-to-many.": can
you rephrase this?
Please specify the relevant fields of tblParent and qryChild. Give us
the sql of qryChild.
Typically the subform is linked to its parent using LinkChildFields
and LinkMasterFields properties of the subform control. Is your form
set up that way?
EVERY table needs to have a PK. Add one to the child table.

General observation about Next/Previous: there is no such thing as a
Next record in a table. That's right. Next only exists after a sort
order has been specified, either implicitly (e.g. open a table in
datasheet view and by default you get the rows ordered by PK) or
explicitly (using the ORDER BY clause). You probably need the latter.

The Text property of a textbox is only available while that textbox
has focus. When you click your nav button, the textbox won't have
focus. The Value property typically is much better.

-Tom.

>I have inherited another developer's database (Access 2003) and with it
a problem I'm struggling with. The problem is this.

I have a parent-child form pair, which is populated by a table (the
parent) and a query (the child). The two sources are linked by an
identical unique number. The table populating the parent uses the number
as primary key. The child table has no primary key so it can used
one-to-many. Users add data through the form for a distinct financial
year end period (FYE).

When the child form loads, it brings in data for the first financial
year end period in the table without a primary key. The user wants to
work in the same form with data for each individual financial year end,
and so needs a command button which calls the next record for the unique
number presently loaded into the form (via a text box) by its next
financial year end, so they can work on data for each financial year.

What I need to do is code something for a command button that takes the
unique number (available through the .Text property of the textbox on
the child form, which is where the data gets added) and the FYE data
(available through a textbox property again), and construct a query that
gets the next record in the table using the number and FYE, and loads it
into the parent and child forms. I will also need a button that moves
them back in the opposite direction.

Help much appreciated, because I'm running out of time! :-)

Thanks.

Tony
Mar 3 '07 #2

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

Similar topics

3
by: varala_kanth | last post by:
hello friends, iam completely new bie iam tracing one perl program . this part of the code </code> sub parseRadAcct {
2
by: Mats | last post by:
I'm trying out some code cause of an idea I just got, but it won't work for each item in Request.Form Response.Write (Request.Form("item")) Response.Write("<br>") next only one <br> per...
3
by: David | last post by:
Hi, I have a .asp page which lists a date, then a bunch of record lines for data that falls within that date, then the next date and it's bunch of data record lines. e.g. Ship Date:...
15
by: Susan Bricker | last post by:
Greetings. I have a Mainform with a subform. The Mainform has single record format and subform has continuous form format. When the Mainform opens, I force allowadditions and allowedits to FALSE...
7
by: todholt | last post by:
Hello, I am trying to bypass a form's automatic update, and instead call a stored procedure in sql server. I am using continuous forms. The problem I am having is with returning to the next...
27
by: Kim Webb | last post by:
I have a field on a form for project number. I basically want it to be the next available number (ie 06010 then 06011 etc). In the form I create a text box and under control source I put: =!=...
7
by: WBonar | last post by:
Is this (subject) a possiblity in access? I need to link the 'id' field in two tables in my database together so the auto number provides unique identifiers ACROSS the two columns. IE if the...
10
by: giannis | last post by:
How can i know ("see") the next record using the BindingSource without move to the next record ?
0
by: voroojak | last post by:
i have a table that is group by customer id. each customer have some infomration that depends on if there is any data for it or not then that line will be visbile or not. when i export data into PDF...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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...
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,...

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.