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

Think is should be simple but carn`t find info:(

Hey Group,

Im Sure this is simple but I carn`t seem to find any info anywhere:(

I have 2 x Forms: Form 1 has a DataConnecter and several DataAdapters on it,
all bound together in my DataSet.

On My Table(Faxs) I have a relationship to another Table(MeterReadings), on
my Form I have a button called "Meter Reading".

How do I get it so that when I select a row from my Database in my datagrid
on my Form1, and click Meter Reading, it loads up Form2 with a Datagrid that
only shows me the meter Readings for the Fax Row I selected on Form 1? If
you get what I mean

Any Links Are help would be greatly appriciated.

Many Thanks
MCN

Nov 20 '05 #1
25 1208
Please use both groups (or all groups in the header so you don't mulitpost)
I answered this over in ADO.NET and I believe I had a more complete answer
to the same problem previously but i don't seem to see it right now.

DataRow dro = DataTable.Rows[dataGrid.SelectedRowIndex];

then pass dro to your new form. You can either create a property in the new
form, or create an overloaded constructor or function that takes a datarow
as a param and then bind to it.

HTH,

Bill

www.devbuzz.com
www.knowdotnet.com

"MadCrazyNewbie" <te**@nospam.com> wrote in message
news:0f********************@karoo.co.uk...
Hey Group,

Im Sure this is simple but I carn`t seem to find any info anywhere:(

I have 2 x Forms: Form 1 has a DataConnecter and several DataAdapters on it, all bound together in my DataSet.

On My Table(Faxs) I have a relationship to another Table(MeterReadings), on my Form I have a button called "Meter Reading".

How do I get it so that when I select a row from my Database in my datagrid on my Form1, and click Meter Reading, it loads up Form2 with a Datagrid that only shows me the meter Readings for the Fax Row I selected on Form 1? If
you get what I mean

Any Links Are help would be greatly appriciated.

Many Thanks
MCN

Nov 20 '05 #2
Hi Mad,

I was busy telling you the same as William did about the multipost, there is
no problem when you crosspost (send one message to more newsgroups) than
others can see if the answer you did get in the adonet group was right for
you.

Because I was busy and with another approach than William I send this also.

You said you had a made a datarelation and I hope binded the maintable using
setdatabinding to the dataset. Than you can do in my opinion something as:

\\\
Dim frm As New Form2
frm.DataGrid1.SetDataBinding(ds, _
"Maintable.DatarelationName")
frm.ShowDialog()
///

I hope this helps?
Cor

Nov 20 '05 #3
Cor,

Sorry I don`t understand what you mean bind the main table using
setdatabings?

Here is my code:

Private Sub frmMainMenuPasswords_Load(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles MyBase.Load
cmDsFax = BindingContext(dsFax, "Faxs")
cmDsPhotoCopiers = BindingContext(dsPhotocopiers, "PhotoCopiers")
mlLoading = True
'Start of Fill Datasets
Try
dsFax.EnforceConstraints = False
dsPhotocopiers.EnforceConstraints = True
Try
Me.odcFaxCopiers.Open()
'Fill Fax Copier Datasets
Me.odaDepartments.Fill(dsFax)
Me.odaSites.Fill(dsFax)
Me.odaFaxs.Fill(dsFax)
'Fill PhotoCopier Datasets
Me.odaDepartments.Fill(dsPhotocopiers)
Me.odaSites.Fill(dsPhotocopiers)
Me.odaPhotoCopiers.Fill(dsPhotocopiers)
Catch fillException As System.Exception
Throw fillException
Finally
Me.odcFaxCopiers.Close()
End Try
Catch eLoad As System.Exception
System.Windows.Forms.MessageBox.Show(eLoad.Message )
Finally
mlLoading = False
End Try
'End of Fill Datasets
End Sub

'Start of Position Changed Code - Faxs
Private Sub cmdsFax_PositionChanged(ByVal sender As Object, ByVal e As
System.EventArgs) Handles cmDsFax.PositionChanged
dsFax_PositionChanged()
End Sub
Private Sub cboFaxsDepartment_SelectedIndexChanged(ByVal sender As
Object, ByVal e As System.EventArgs) Handles
cboFaxsDepartment.SelectedIndexChanged
Me.BindingContext(dsFax, "Faxs").EndCurrentEdit()
If Me.BindingContext(dsFax, "Faxs").Position <> -1 And Not mlLoading
Then
dsFax.Faxs.Rows(Me.BindingContext(dsFax,
"Faxs").Position).Item("DepartmentID") = Me.cboFaxsDepartment.SelectedValue
End If
End Sub
Private Sub cbofaxsSite_SelectedIndexChanged(ByVal sender As Object,
ByVal e As System.EventArgs) Handles cboFaxsSite.SelectedIndexChanged
Me.BindingContext(dsFax, "Faxs").EndCurrentEdit()
If Me.BindingContext(dsFax, "Faxs").Position <> -1 And Not mlLoading
Then
dsFax.Faxs.Rows(Me.BindingContext(dsFax,
"Faxs").Position).Item("SitesID") = Me.cboFaxsDepartment.SelectedValue
End If
End Sub
Private Sub dsFax_PositionChanged()
Me.BindingContext(dsFax, "Faxs").EndCurrentEdit()
If Me.BindingContext(dsFax, "Faxs").Position <> -1 And Not mlLoading
Then
Me.cboFaxsDepartment.SelectedValue =
dsFax.Faxs.Rows(Me.BindingContext(dsFax,
"Faxs").Position).Item("DepartmentID")
Me.cboFaxsSite.SelectedValue = dsFax.Faxs.Rows(Me.BindingContext(dsFax,
"Faxs").Position).Item("SitesID")
End If
End Sub

Many Again Thanks
MCN

'End of Position Changed Code - Faxs
"Cor Ligthert" <no**********@planet.nl> wrote in message
news:OU**************@TK2MSFTNGP09.phx.gbl...
Hi Mad,

I was busy telling you the same as William did about the multipost, there is no problem when you crosspost (send one message to more newsgroups) than
others can see if the answer you did get in the adonet group was right for
you.

Because I was busy and with another approach than William I send this also.
You said you had a made a datarelation and I hope binded the maintable using setdatabinding to the dataset. Than you can do in my opinion something as:

\\\
Dim frm As New Form2
frm.DataGrid1.SetDataBinding(ds, _
"Maintable.DatarelationName")
frm.ShowDialog()
///

I hope this helps?
Cor

Nov 20 '05 #4
Hi Mad,

I do not see how the code has to do with the question.

I see nothing about a datagrid on form1 eiter on form1 or a relation to the
table "meterreading"

This is your text
---------------------------
On My Table(Faxs) I have a relationship to another Table(MeterReadings), on
my Form I have a button called "Meter Reading".

How do I get it so that when I select a row from my Database in my datagrid
on my Form1, and click Meter Reading, it loads up Form2 with a Datagrid that
only shows me the meter Readings for the Fax Row I selected on Form 1? If
you get what I mean
--------------------
What is the reason of my confusion?

Cor
Nov 20 '05 #5
He's got a valid point Si.

Follow Williams advice, its correct.

But to add...

Set a property on Form 2 for your key/index whatever you want to have the
forms data "based" off of..

so.. if the key in Faxes was idFax set a property in form 2 called idFax or
whatever you want..

Then...

.... williams stuff here.

.... find the row

dim myForm as Form2

myForm2.idFax = [therow id you found or whatever you want to set]

myform2.show()

in the property, do whatever you need to do to populate the grid

hope it helps,
cj

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:u8**************@tk2msftngp13.phx.gbl...
Hi Mad,

I do not see how the code has to do with the question.

I see nothing about a datagrid on form1 eiter on form1 or a relation to the table "meterreading"

This is your text
---------------------------
On My Table(Faxs) I have a relationship to another Table(MeterReadings), on my Form I have a button called "Meter Reading".

How do I get it so that when I select a row from my Database in my datagrid on my Form1, and click Meter Reading, it loads up Form2 with a Datagrid that only shows me the meter Readings for the Fax Row I selected on Form 1? If
you get what I mean
--------------------
What is the reason of my confusion?

Cor

Nov 20 '05 #6
Hi CJ,

When there is a relation created, than that code that I did provide works as
a charm with a datagrid and a dataset.

However with those comboboxes I go for a solution just providing the
selectedindex to the form and the dataset in a sub (that are only
references). Has the same simplisity.

Cor
Nov 20 '05 #7
Cor,

Not arguing your method. Just going off experience of working with Simon
and actually seeing a vast majority of the program (if not all of it) within
the past week.

Given his level of VB.NET, current undersatnding of different objects etc..
this just seemed to be the best approach for him.

No offense meant to either of you.

-CJ
"Cor Ligthert" <no**********@planet.nl> wrote in message
news:OB**************@tk2msftngp13.phx.gbl...
Hi CJ,

When there is a relation created, than that code that I did provide works as a charm with a datagrid and a dataset.

However with those comboboxes I go for a solution just providing the
selectedindex to the form and the dataset in a sub (that are only
references). Has the same simplisity.

Cor

Nov 20 '05 #8
Hi CJ,

As forever I did understand what you wrote in your earlier message of
course, however this was what Bill wrote and and I am afraid that Simon and
I are on the same level, because I do not understand this. (I did not want
to write this but for the sake of Simon you forced me to that).

In this thread
--------------------
DataRow dro = DataTable.Rows[dataGrid.SelectedRowIndex];

then pass dro to your new form. You can either create a property in the new
form, or create an overloaded constructor or function that takes a datarow
as a param and then bind to it.
---------------------
And this in the ADONET group which I do not understand either
---------------------
Private _RowHolder As DataRow
Public Property RowHolder() As DataRow
Get
Return _RowHolder
End Get
Set(ByVal Value As DataRow)
_RowHolder = Value
End Set
End Property
Public Sub New(ByVal _Holder As DataRow)
Me.RowHolder = _Holder
End Sub

Then, no form1 use Dim frm as New
SecondGridForm(DataTableName.Rows[DataGrid.CurrentRowIndex])
frm.ShowDialog ' or .Show() depending on your needs
Then, once it's set you can do whatever you want on frm. Howver, if you
need the value you'll have it via frm.RowHolder as long as you remember to
reference on the second form with me.RowHolder
---------------------

Maybe you can explain this to us something deeper in the context of the
question from Simon?

(To make it something clearer, I can bind a table (or mostly an Ilist) as a
dataasource to any control however how to bind a datarow to a complex
control that do I not know).

Cor
Nov 20 '05 #9
Hey CJ/Cor/William,

Hope you could advise me a little again?

Now i`ve got in my Button Click Event on my first form(frmFaxs):

Dim LoadFaxMeterReadings As frmFaxMeterReadings()
LoadFaxMeterReadings.FaxID(BindingContext(dsFax, "Faxs").Position)
LoadFaxMeterReadings.Show()

(The Above tells me FAXID & Show are not members of System.Array)

On My Second form I have:

Public Property RowHolder() As DataRow
Get
Return RowHolder
End Get
Set(ByVal Value As DataRow)
RowHolder = Value
End Set
End Property

Public Sub New(ByVal Holder As DataRow)
Me.RowHolder = Holder
End Sub

Private Sub frmFaxMeterReadings_Load(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles MyBase.Load
mlLoading = True
'Start of Fill Datasets
Try
dsFaxMeterReadings.EnforceConstraints = False
Try
Me.odcFaxMeterReadings.Open()
'Fill Arciris Roles Datasets
Me.odaFaxMeterReadings.Fill(dsFaxMeterReadings)
Catch fillException As System.Exception
Throw fillException
Finally
Me.odcFaxMeterReadings.Close()
End Try
Catch eLoad As System.Exception
System.Windows.Forms.MessageBox.Show(eLoad.Message )
Finally
mlLoading = False
End Try
'End of Fill Datasets
End Sub

Im I understanding this or am I going about this totally wrongs?

Many Thanks
MCN

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi CJ,

As forever I did understand what you wrote in your earlier message of
course, however this was what Bill wrote and and I am afraid that Simon and I are on the same level, because I do not understand this. (I did not want
to write this but for the sake of Simon you forced me to that).

In this thread
--------------------
DataRow dro = DataTable.Rows[dataGrid.SelectedRowIndex];

then pass dro to your new form. You can either create a property in the new form, or create an overloaded constructor or function that takes a datarow
as a param and then bind to it.
---------------------
And this in the ADONET group which I do not understand either
---------------------
Private _RowHolder As DataRow
Public Property RowHolder() As DataRow
Get
Return _RowHolder
End Get
Set(ByVal Value As DataRow)
_RowHolder = Value
End Set
End Property
Public Sub New(ByVal _Holder As DataRow)
Me.RowHolder = _Holder
End Sub

Then, no form1 use Dim frm as New
SecondGridForm(DataTableName.Rows[DataGrid.CurrentRowIndex])
frm.ShowDialog ' or .Show() depending on your needs
Then, once it's set you can do whatever you want on frm. Howver, if you
need the value you'll have it via frm.RowHolder as long as you remember to
reference on the second form with me.RowHolder
---------------------

Maybe you can explain this to us something deeper in the context of the
question from Simon?

(To make it something clearer, I can bind a table (or mostly an Ilist) as a dataasource to any control however how to bind a datarow to a complex
control that do I not know).

Cor

Nov 20 '05 #10
Hi Mad,

With the change to get angry messages from CJ and Bill, I give you my third
way to go, now I see how far you are. All is done in line and are the rows
without the >, deleted rows you have to check yourself. All typed in here by
hand and not in the designer so there can be typos. However in my opinion
this should go.

Dim LoadFaxMeterReadings As New frmFaxMeterReadings()
LoadFaxMeterReadings.FaxId= *The value from the combobox or the datagrid, I
do not know what it is now.* so if this stays a problem message that.
LoadFaxMeterReadings.Showdialog

In frmFaxMeterReading you add after the desinger created code

Public FaxId as string

You have probably to change your selection string, and I when you are using
SQL server
Then selection string has to be something like this
"SELECT * FROM Mytable WHERE Faxs = @Faxs"
Public Sub New(ByVal Holder As DataRow)
Me.RowHolder = Holder
End Sub

Private Sub frmFaxMeterReadings_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
mlLoading = True
odaFaxMeterReadings.SelectCommand.Parameters.Add(N ew SqlParameter("@Fax",
SqlDbType.Char, 30)).Value = FaxId
*** you have to set the right type and the lenght in this***********
'Start of Fill Datasets
Try
dsFaxMeterReadings.EnforceConstraints = False
Try
Me.odcFaxMeterReadings.Open()
'Fill Arciris Roles Datasets
Me.odaFaxMeterReadings.Fill(dsFaxMeterReadings)
Catch fillException As System.Exception
Throw fillException
Finally
Me.odcFaxMeterReadings.Close()
End Try
Catch eLoad As System.Exception
System.Windows.Forms.MessageBox.Show(eLoad.Message )
Finally
mlLoading = False
End Try
'End of Fill Datasets
dim dv as new dataview(dsFaxMeterReadings)
datagrid1.datasource = dv
End Sub


I hope this helps and hope as well on not to hard messages from CJ and Bill.

Cor
Nov 20 '05 #11
Cor,

Sorry but i don`t understand what goes here:
LoadFaxMeterReadings.FaxId= *The value from the combobox or the datagrid, I do not know what it is now*

also would I still use:
odaFaxMeterReadings.SelectCommand.Parameters.Add(N ew SqlParameter("@Fax",
SqlDbType.Char, 30)).Value = FaxId
Even though im using Access?

Many Thanks
MCN

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:%2****************@tk2msftngp13.phx.gbl... Hi Mad,

With the change to get angry messages from CJ and Bill, I give you my third way to go, now I see how far you are. All is done in line and are the rows
without the >, deleted rows you have to check yourself. All typed in here by hand and not in the designer so there can be typos. However in my opinion
this should go.

Dim LoadFaxMeterReadings As New frmFaxMeterReadings()
LoadFaxMeterReadings.FaxId= *The value from the combobox or the datagrid, I do not know what it is now.* so if this stays a problem message that.
LoadFaxMeterReadings.Showdialog

In frmFaxMeterReading you add after the desinger created code

Public FaxId as string

You have probably to change your selection string, and I when you are

using SQL server
Then selection string has to be something like this
"SELECT * FROM Mytable WHERE Faxs = @Faxs"
Public Sub New(ByVal Holder As DataRow)
Me.RowHolder = Holder
End Sub

Private Sub frmFaxMeterReadings_Load(ByVal sender As System.Object,
ByVal e
As System.EventArgs) Handles MyBase.Load
mlLoading = True
odaFaxMeterReadings.SelectCommand.Parameters.Add(N ew SqlParameter("@Fax",
SqlDbType.Char, 30)).Value = FaxId
*** you have to set the right type and the lenght in this***********
'Start of Fill Datasets
Try
dsFaxMeterReadings.EnforceConstraints = False
Try
Me.odcFaxMeterReadings.Open()
'Fill Arciris Roles Datasets
Me.odaFaxMeterReadings.Fill(dsFaxMeterReadings)
Catch fillException As System.Exception
Throw fillException
Finally
Me.odcFaxMeterReadings.Close()
End Try
Catch eLoad As System.Exception
System.Windows.Forms.MessageBox.Show(eLoad.Message )
Finally
mlLoading = False
End Try
'End of Fill Datasets


dim dv as new dataview(dsFaxMeterReadings)
datagrid1.datasource = dv
End Sub


I hope this helps and hope as well on not to hard messages from CJ and

Bill.
Cor

Nov 20 '05 #12
Hi Mad,

I try to explain it in words.

What we are doing now is create an public variable in your second form.
That has to be the Id of the fax as it is selected in: And here I am not
sure if that is a combobox on your form1 or a datagrid, when I know that I
can tell something more.

Than we open the form2 and give the FaxId to that.
In that form2 you are reading the Faxdataset I saw, however we limit it to
only the faxId you did want.

The OleDB needs some litle changes. the Select string becomes for OleDB
(access) something as.
"SELECT * FROM Mytable WHERE Fax = ?"

And the parameter becomes (if you have set an imports to system.IO.oledb)
odaFaxMeterReadings.SelectCommand.Parameters.Add(N ew OleDbParameter("Fax",
OleDbType.Char)).Value = FaxId

http://msdn.microsoft.com/library/de...sAddTopic2.asp

However tell me about where we get that FaxId?

Cor
Nov 20 '05 #13
Hi Cor, sorry again about my other post my post still hasn`t show up on
outlook:( anyways.

On my Faxs Form (Form1) i have a datagrid and serveral comboboxs, however I
want the user to selct the row via the datagird. once they have selected the
row they click on the FaxMeterReadings button to take them to
FaxMeterReadings (Form2)

Thanks Again
MCN

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hi Mad,

I try to explain it in words.

What we are doing now is create an public variable in your second form.
That has to be the Id of the fax as it is selected in: And here I am not
sure if that is a combobox on your form1 or a datagrid, when I know that I
can tell something more.

Than we open the form2 and give the FaxId to that.
In that form2 you are reading the Faxdataset I saw, however we limit it to
only the faxId you did want.

The OleDB needs some litle changes. the Select string becomes for OleDB
(access) something as.
"SELECT * FROM Mytable WHERE Fax = ?"

And the parameter becomes (if you have set an imports to system.IO.oledb)
odaFaxMeterReadings.SelectCommand.Parameters.Add(N ew OleDbParameter("Fax",
OleDbType.Char)).Value = FaxId

http://msdn.microsoft.com/library/de...sAddTopic2.asp
However tell me about where we get that FaxId?

Cor

Nov 20 '05 #14
Ok

Then you need something as this in your button event on form1

Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Dim frm2 As New Form2
frm2.faxId = Me.DataGrid1.Item(DataGrid1.CurrentRowIndex, 0).ToString
frm2.ShowDialog()
End Sub

The 0 you see is the columnindex from the datagrid where the faxId is
located.
So that is one of the things you have to change.

Now it should work.
And when not tell what happens.

Cor

On my Faxs Form (Form1) i have a datagrid and serveral comboboxs, however I want the user to selct the row via the datagird. once they have selected the row they click on the FaxMeterReadings button to take them to
FaxMeterReadings (Form2)

Nov 20 '05 #15
Cor,

It tells me that FaxID is not a Member of FaxMeterReadingsForm

What do I need to set as FaxID? CJ said to set a property on the Form for my
Key/Index? whats does this need to be?

Many Thanks Again
MCN

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Ok

Then you need something as this in your button event on form1

Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Dim frm2 As New Form2
frm2.faxId = Me.DataGrid1.Item(DataGrid1.CurrentRowIndex, 0).ToString frm2.ShowDialog()
End Sub

The 0 you see is the columnindex from the datagrid where the faxId is
located.
So that is one of the things you have to change.

Now it should work.
And when not tell what happens.

Cor

On my Faxs Form (Form1) i have a datagrid and serveral comboboxs,
however I
want the user to selct the row via the datagird. once they have selected

the
row they click on the FaxMeterReadings button to take them to
FaxMeterReadings (Form2)


Nov 20 '05 #16
Cor,

Another Thing I have on my FaxMeterReadingTable:

MeterReadingID(PrimaryKey), FaxID(Lookup to FaxID(PrimaryKey of My Fax
Table), Date, & Reading.

I think i`ve built the table right as my Parent Table is Faxs and my Child
Table is FaxMeterReadings (Belive i`ve got it right in a One-Two-Many
Relationship)

Just thought id better check My Database Was right first

Thanks Again
MCN

"MadCrazyNewbie" <te**@nospam.com> wrote in message
news:E9********************@karoo.co.uk...
Cor,

It tells me that FaxID is not a Member of FaxMeterReadingsForm

What do I need to set as FaxID? CJ said to set a property on the Form for my Key/Index? whats does this need to be?

Many Thanks Again
MCN

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Ok

Then you need something as this in your button event on form1

Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Dim frm2 As New Form2
frm2.faxId = Me.DataGrid1.Item(DataGrid1.CurrentRowIndex,

0).ToString
frm2.ShowDialog()
End Sub

The 0 you see is the columnindex from the datagrid where the faxId is
located.
So that is one of the things you have to change.

Now it should work.
And when not tell what happens.

Cor

On my Faxs Form (Form1) i have a datagrid and serveral comboboxs, however
I
want the user to selct the row via the datagird. once they have

selected the
row they click on the FaxMeterReadings button to take them to
FaxMeterReadings (Form2)



Nov 20 '05 #17
Did you do this as I wrote?

In FaxMeterReadingForm you add after the desinger created code

Public FaxId as string

Cor

It tells me that FaxID is not a Member of FaxMeterReadingsForm

Nov 20 '05 #18
Hi Simon,

I think that you can better first make this to an end and than look how to
optimize it.
You are almost there that there will be a table displayed.

Cor
Nov 20 '05 #19
Sorry Cor,

I misted that one:( Right cool seems to load up my form now:) only thing is
it dosn`t display the meter reading for just that fax I selected, instead is
fills my DataGrid with All Details from All Faxs:(

Any Ideas?

Many Thanks
MCN
"Cor Ligthert" <no**********@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Did you do this as I wrote?

In FaxMeterReadingForm you add after the desinger created code

Public FaxId as string

Cor

It tells me that FaxID is not a Member of FaxMeterReadingsForm


Nov 20 '05 #20
Hi Mad,

That was this part
The OleDB needs some litle changes. the Select string becomes for OleDB
(access) something as.
"SELECT * FROM Mytable WHERE Fax = ?"

Should be your table of course and the right name for the faxId field in
your accessfile.

And than this right before the fill

Also with the right name (this is case sensetive) for the faxId.

odaFaxMeterReadings.SelectCommand.Parameters.Add(N ew OleDbParameter("Fax",
OleDbType.Char)).Value = FaxId
http://msdn.microsoft.com/library/de...sAddTopic2.asp

Than it should give only the one fax you selected,

Cor


I misted that one:( Right cool seems to load up my form now:) only thing is it dosn`t display the meter reading for just that fax I selected, instead is fills my DataGrid with All Details from All Faxs:(

Any Ideas?

Many Thanks
MCN
"Cor Ligthert" <no**********@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Did you do this as I wrote?

In FaxMeterReadingForm you add after the desinger created code

Public FaxId as string

Cor

It tells me that FaxID is not a Member of FaxMeterReadingsForm



Nov 20 '05 #21
Cor,

Do I need to put the "SELECT * FROM Faxs WHERE Fax = FaxID" in My
DataAdapter on Form 2?

On my Form 2 I`ve created 2 x Dataadapters odaFaxs, and odaFaxMeterReadings
and bound them in my DS.

Now on my form 2 x I have:

Me.odcFaxMeterReadings.Open()
odaFaxMeterReading.SelectCommand.Parameters.Add(Ne w
OleDb.OleDbParameter("Checked", OleDb.OleDbType.Char)).Value = FaxId
Me.odaFaxs.Fill(dsFaxMeterReadings)
Me.odaFaxMeterReading.Fill(dsFaxMeterReadings)
Catch fillException As System.Exception
Throw fillException
Finally
Me.odcFaxMeterReadings.Close()

Is this Correct? or im I understanding wrong?

When I click on my FaxMeterReading Button on Form one I get a error saying
"No Value Given for one or more Parameters"

MAny Thanks Again
MCN

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:Ox**************@TK2MSFTNGP09.phx.gbl...
Hi Mad,

That was this part
The OleDB needs some litle changes. the Select string becomes for OleDB
(access) something as.
"SELECT * FROM Mytable WHERE Fax = ?"

Should be your table of course and the right name for the faxId field in
your accessfile.

And than this right before the fill

Also with the right name (this is case sensetive) for the faxId.

odaFaxMeterReadings.SelectCommand.Parameters.Add(N ew OleDbParameter("Fax",
OleDbType.Char)).Value = FaxId
http://msdn.microsoft.com/library/de...sAddTopic2.asp
Than it should give only the one fax you selected,

Cor


I misted that one:( Right cool seems to load up my form now:) only thing is
it dosn`t display the meter reading for just that fax I selected,

instead is
fills my DataGrid with All Details from All Faxs:(

Any Ideas?

Many Thanks
MCN
"Cor Ligthert" <no**********@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Did you do this as I wrote?

In FaxMeterReadingForm you add after the desinger created code

Public FaxId as string

Cor
>
> It tells me that FaxID is not a Member of FaxMeterReadingsForm
>



Nov 20 '05 #22
Hi Mad,

It is in this approach important that in Form2 only the selected fax is
readed.

So I am talking about the selectionstring from that, somewhere there has to
be a selectionstring in that form, because you fill it from that, ( I assume
you have no shared database class now).

And that is than the one for which for the faxes this WHERE part in my
opinion should be added.

Cor

Do I need to put the "SELECT * FROM Faxs WHERE Fax = FaxID" in My
DataAdapter on Form 2?

On my Form 2 I`ve created 2 x Dataadapters odaFaxs, and odaFaxMeterReadings and bound them in my DS.

Now on my form 2 x I have:

Me.odcFaxMeterReadings.Open()
odaFaxMeterReading.SelectCommand.Parameters.Add(Ne w
OleDb.OleDbParameter("Checked", OleDb.OleDbType.Char)).Value = FaxId
Me.odaFaxs.Fill(dsFaxMeterReadings)
Me.odaFaxMeterReading.Fill(dsFaxMeterReadings)
Catch fillException As System.Exception
Throw fillException
Finally
Me.odcFaxMeterReadings.Close()

Is this Correct? or im I understanding wrong?

When I click on my FaxMeterReading Button on Form one I get a error saying
"No Value Given for one or more Parameters"

Nov 20 '05 #23
Sorry Cor,

I think im lost again:( Do you mean:

On Both My DataAdapeters use the following "SELECT * From <TABLENAME>

Then in my code:

Dim sqlFaxMeterReadings As sqlString
sqlFaxMeterReadings = "SELECT * FROM Faxs WHERE Fax = FaxID"

If the above is correct and im not getting confused, how do I tell it to use
that on my .Fill or .Open commands?

Many Thanks
MCN

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:uz**************@TK2MSFTNGP12.phx.gbl...
Hi Mad,

It is in this approach important that in Form2 only the selected fax is
readed.

So I am talking about the selectionstring from that, somewhere there has to be a selectionstring in that form, because you fill it from that, ( I assume you have no shared database class now).

And that is than the one for which for the faxes this WHERE part in my
opinion should be added.

Cor

Do I need to put the "SELECT * FROM Faxs WHERE Fax = FaxID" in My
DataAdapter on Form 2?

On my Form 2 I`ve created 2 x Dataadapters odaFaxs, and

odaFaxMeterReadings
and bound them in my DS.

Now on my form 2 x I have:

Me.odcFaxMeterReadings.Open()
odaFaxMeterReading.SelectCommand.Parameters.Add(Ne w
OleDb.OleDbParameter("Checked", OleDb.OleDbType.Char)).Value = FaxId
Me.odaFaxs.Fill(dsFaxMeterReadings)
Me.odaFaxMeterReading.Fill(dsFaxMeterReadings)
Catch fillException As System.Exception
Throw fillException
Finally
Me.odcFaxMeterReadings.Close()

Is this Correct? or im I understanding wrong?

When I click on my FaxMeterReading Button on Form one I get a error saying "No Value Given for one or more Parameters"


Nov 20 '05 #24
Hi Max,

show those selectstrings in your dataadapters as they are now (only form2),
than I think I get more information

Cor

Nov 20 '05 #25
Many Thanks to Cor, Who has helped me with the problem Offline (After about
30 e-mails)

Many Thanks Again - Cor

Thanks
MCN

"MadCrazyNewbie" <te**@nospam.com> wrote in message
news:dz********************@karoo.co.uk...
On its way.

Thanks
MCN

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:OU****************@TK2MSFTNGP11.phx.gbl...
Hi Mad,

My adres is in my mail it is original however notmyfirstname, only my
lastname.

Cor


Nov 20 '05 #26

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

Similar topics

28
by: grahamd | last post by:
Who are the appropriate people to report security problems to in respect of a module included with the Python distribution? I don't feel it appropriate to be reporting it on general mailing lists.
72
by: The Plankmeister | last post by:
Is doing this bad: <h3>Some title or other...<a href="#pagetop">back to top</a></h3> I have a feeling it is... My problem is I'm using CSS to style the H3 into a block that spans the whole...
86
by: Michael Kalina | last post by:
Because when I asked for comments on my site-design (Remember? My site, your opinion!) some of you told me never to change anything on font-sizes! What do you guys think of that:...
32
by: someone else | last post by:
hi all I'm a newbie to this group. my apologies if I break any rules. I've wrote a simple program to find the first 1,000,000 primes, and to find all primes within any range (up to 200 *...
1
by: aredo3604gif | last post by:
On Sun, 10 Apr 2005 19:46:32 GMT, aredo3604gif@yahoo.com wrote: >The user can dynamically enter and change the rule connection between >objects. The rule is a "<" and so given two objects: >a <...
9
by: Peter Oliphant | last post by:
For some reson my code is generating a LNK1215 error, which 'suggests' I re-install VS C++. So I did. which did NOT solve the problem. The weid part is it seems to be caused by my one CPP file, but...
2
by: Abel Chan | last post by:
Hi there, I just got an assignment to work on server maintenance. It is a weekly task and we have about 7 production servers running Win2K server. The tasks include but not limited to 1)...
1
by: Roy | last post by:
I'm assuming this is amazingly simple and I'm just missing the boat. On the html side of an asp.net page I have a datagrid, a "search" button, and 8 text boxes for search criteria. A user enters...
2
by: Evan | last post by:
Hey, I posted this yesterday, but no one had any ideas? C'mon now, I know this isn't that hard, i'm just a little new to javascript, and I can't quite figure this out. I searched and searched to...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.