473,563 Members | 2,762 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Navigate related records

Bob
Hello:

I'm building a simple windows database application that has two tables with
One to One relationships on MS Access tables.

I know what your thinking. Why not just use one table? because MS Access
has a field count limitation of 255 and my table would have 327 fields so I
have no choice.

I'm using two Data adapters that generate a single DS with a relationship
build on the ClientID fields.

I dont' wish to use a datagride because the customer doesn't want it.

I can't figure out how to make my app populate the fields in my form with
the child data when the dataset loads and moves to the next record.

Below is what I have and it works ok:

Me.BindingConte xt(objdsClients , "ClientsMain"). Position =
(Me.BindingCont ext(objdsClient s, "ClientsMain"). Position +
1)Me.BindingCon text(objdsClien ts, "ClientsPage01" ).Position =
(Me.BindingCont ext(objdsClient s, "ClientsPage01" ).Position + 1)
But as you know, it can quickly cause problems later if the child table
doesn't have a child record added for some reason like a power failur or
something else.

I built the relationship in Query Designer

Any help would be appriciated

TIA

Bob
Nov 21 '05 #1
15 1462
Bob,

Why do you make it yourself difficult, why don't you use just two datatables
in one dataset. They only need to have the same key.

It would have been a problem if you was using a datagrid, however you don't
have that problem.

By the way, I am curious how do you get 327 textboxes on one form?

I hope this helps,

Cor
Nov 21 '05 #2
LOL

--
Terry Burns
http://TrainingOn.net
"Cor Ligthert" <no************ @planet.nl> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
Bob,

Why do you make it yourself difficult, why don't you use just two
datatables in one dataset. They only need to have the same key.

It would have been a problem if you was using a datagrid, however you
don't have that problem.

By the way, I am curious how do you get 327 textboxes on one form?

I hope this helps,

Cor

Nov 21 '05 #3
Bob
Cor:

Yeah thats why I don't understand why it doesn't work. I am using just one
dataset.

Maybe I only need one oleDBDataAdapte r also and join the tables there?
Anyway, I tried that but all I got was constraint probs.

The examples I see use two oleDBDataAdapte rs and generate one DS.

I found an example that uses a Combo Box and I'm not. I might be making
headway with the code. Not sure yet.
Thanks

Bob
Nov 21 '05 #4
Bob,

Why do you not, show us some snippets of your code, (Not the designer part
pleast that we know very much). And than first copied, pasted, copied pasted
with a notebook to get it readable.

Cor
Nov 21 '05 #5
Bob
Private Sub btnNavNext_Clic k(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnNavNext.Clic k
Me.BindingConte xt(objdsClients , "ClientsMain"). Position =
(Me.BindingCont ext(objdsClient s, "ClientsMain"). Position + 1)
'Me.BindingCont ext(objdsClient s, "ClientsPage01" ).Position =
(Me.BindingCont ext(objdsClient s, "ClientsPage01" ).Position + 1)
'Me.txtSBLNum.D ataBindings.Add (New
System.Windows. Forms.Binding(" Text", objdsClients,
"ClientsMain.PK _ClientID.Clien tID"))
Dim SelectClientID As String
SelectClientID = editClientID.Te xt.ToString()
Dim drSelectedClien t As DataRow
drSelectedClien t =
objdsClients.Cl ientsMain.FindB yClientID(Selec tClientID)
' Declare an array of data rows to hold the related records.
Dim draPage01 As DataRow()
draPage01 = drSelectedClien t.GetChildRows( "ClientsPage01" )
' Display the length of the array (number of orders)
' and the CustomerID in the form caption.
'Me.Text = draPage01.Lengt h.ToString() & " Client Pages " &
SelectClientID

Dim drPage1 As DataRow
For Each drPage1 In draPage01
'lbOrders.Items .Add(drOrder("O rderID"))
Next

Me.objdsClients _PositionChange d()

End Sub
Nov 21 '05 #6
Bob
Cor:

Yeah I'm curious how I'm going to get 327 fields on a form too. I don't
have anything briliant but I think I'm going to put as many as I can into
groupboxes and use the visible property in my code to show and hide the
fields consecutively as the user enters data.

Bob
Nov 21 '05 #7
Bob,

Can you try this sample that I made for you, it uses only two textboxes and
a button, however the problem with the two datatables and the solution
should be the same.

\\\Needs only two textboxes and a button on a form and pasting this code in
Dim ds As DataSet
Private Sub Form1_Load(ByVa l sender As System.Object, _
ByVal e As System.EventArg s) Handles MyBase.Load
ds = CreateDs()
Me.TextBox1.Dat aBindings.Add(" Text", ds.Tables(0), "Country")
Me.TextBox2.Dat aBindings.Add(" Text", ds.Tables(1), "State")
End Sub
Private Sub Button1_Click(B yVal sender As System.Object, _
ByVal e As System.EventArg s) Handles Button1.Click
Dim cma1 As CurrencyManager _
= DirectCast(Bind ingContext(ds.T ables(0)), CurrencyManager )
Dim cma2 As CurrencyManager _
= DirectCast(Bind ingContext(ds.T ables(1)), CurrencyManager )
If cma1.Position < ds.Tables(0).Ro ws.Count - 1 Then
cma1.Position += 1
Else
cma1.Position = 0
End If
cma2.Position = cma1.Position
End Sub
Private Function CreateDs() As DataSet
Dim ds As New DataSet
Dim dtName As New DataTable("Pers ons")
Dim dtCountry As New DataTable("Coun tries")
dtCountry.Colum ns.Add("Country ")
ds.Tables.Add(d tCountry)
dtCountry.LoadD ataRow(New Object() {"EU"}, True)
dtCountry.LoadD ataRow(New Object() {"EU"}, True)
dtCountry.LoadD ataRow(New Object() {"US"}, True)
dtCountry.LoadD ataRow(New Object() {"US"}, True)
Dim dtStates As New DataTable("Stat es")
dtStates.Column s.Add("State")
ds.Tables.Add(d tStates)
dtStates.LoadDa taRow(New Object() {"Austria"}, True)
dtStates.LoadDa taRow(New Object() {"Holland"}, True)
dtStates.LoadDa taRow(New Object() {"Florida"}, True)
dtStates.LoadDa taRow(New Object() {"New York"}, True)
Return ds
End Function
///

I hope this helps,

Cor
Nov 21 '05 #8
Bob
I don't think it will work because ds doesn't get declared in the button
click and the form load events but I'll try it around 9:30 am EDT
Nov 21 '05 #9
Bob
ooppss my bad. I see it
Nov 21 '05 #10

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

Similar topics

17
1839
by: Steve Jorgensen | last post by:
Terminology question: Is there a term for a set of records related directly or indirectly by key value in several tables? For example, a single invoice record and its line item records -or- a single customer, the customer's orders, the order lines for those orders, the customer's invoices, and the invoice lines for those invoices. I'm...
3
11092
by: Jason | last post by:
I am trying to filter records in a primary form based on records in related tables. The data in the related tables is being displayed in the primary form through subforms. To be more specific, I have a primary form named TestResults, which is connected to data in a table named TestResults. There are basically two other tables that are...
0
1529
by: Oberon | last post by:
How do I navigate through records using drag 'n' drop controls? I have an example in C# for Windows forms that relies on BindingContext but this is not available for ASP.NET. How do I solve that problem? PS: I don't need a code example showing me how to do it without drag 'n' drop because I already know how. I WANT to learn how to do it...
1
1725
by: AA Arens | last post by:
I have a form with navigation button and they brows through the records. How to change the order or the way these records are navigated? Like before based on ID, now I want based on another field, like Name field. Bart Acc 2003
2
4749
by: =?Utf-8?B?QmVybmFyZCBLaW0=?= | last post by:
I have VC# 2005. I need to use ADODB instead with ADO.NET. I can open a recordset. however, I can not navigate records in recordset. How can I navigate records? What is the command line for adorecordset.movenext, adorecordset,movefirst...etc. Please help me out.
11
3232
misscrf
by: misscrf | last post by:
I have received data which contains similar records, where the customers have similar records. A customer, i.e. Jane Doe may have moved, or something, or a change to her account. When that happened she was given a new customer ID, and all future orders were tied to that. So now we have 3 Jane Doe records, but they are really all related. What...
1
1980
by: Lumpy | last post by:
Hi all, I have have been lucky to get some good advice in regards to some access questions I have had so far. The good news is I am almost done with this project but I seem to have hit another bump in the road. I have all my tables designed, I have all my forms made and working, and then I added in a switchboard as a central point of...
1
2136
by: BASSPU03 | last post by:
I've set my combobox to operate according to this option: "Find a record on my form based on a value I selected from my combobox." When I select a value from the combobox, I can see that the record on the navigation bar changes accordingly. (Example: Select "2000" and record is 1 of 21; select 2001 and record is 2 of 21; and so forth.) ...
0
1635
by: cannonpm | last post by:
Greetings and salutations. I have developed an A2K3 MDB and have a search form modeled after Allen Browne's search form (http:// allenbrowne.com/ser-62.html). It works well except for records which have multiple related records in 1:many relationships and many:to:many relationships. To view my results, I created a query called qryAllData...
0
7664
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...
0
8106
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...
1
7638
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6250
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...
1
5484
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...
0
3642
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2082
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
1
1198
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.