473,405 Members | 2,185 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,405 software developers and data experts.

how to get the OrderDetailID of a record I sellected in Orderdetail subform?

Dear all,

The OrderDetail subform has following fields:

OrderDetailID OrderID ProdID Quantity Price

how to get the OrderDetailID of a record I sellected in Orderdetail subform
using VBA?

Thank you very much

Paul
Nov 13 '05 #1
6 1570
Code in the main form would refer to the subform's OrderDetailID like this:

Me![MySubform].form![OrderDetailID]

"Paul T. RONG" <et***@hotmail.com> wrote in message
news:9I******************@news.chello.at...
Dear all,

The OrderDetail subform has following fields:

OrderDetailID OrderID ProdID Quantity Price

how to get the OrderDetailID of a record I sellected in Orderdetail subform using VBA?

Thank you very much

Paul

Nov 13 '05 #2
Dave,

Thank you. What I want to do is a little bit different, I mean how to get
the OrderDetailID of the record I JUST SELECTED in the OrderDetail subform

for example:

OrderDetailID OrderID ProdID Quantity Price
157 75 012 25 105
158 75 006 10 89
159 75 003 9 78
....

Now I SELECTED the second record, the OrderDetailID is 158, but through VBA
how can I get this OrderDetailID?

Does it have something to do with the action "SELECT"?

Thank you again. I appreciate your help very much.

Paul


"Dave M" <NO************@DROPTHISisland.net> дÈëÏûÏ¢ÐÂÎÅ
:UkIsd.415462$Pl.198673@pd7tw1no...
Code in the main form would refer to the subform's OrderDetailID like this:
Me![MySubform].form![OrderDetailID]

"Paul T. RONG" <et***@hotmail.com> wrote in message
news:9I******************@news.chello.at...
Dear all,

The OrderDetail subform has following fields:

OrderDetailID OrderID ProdID Quantity Price

how to get the OrderDetailID of a record I sellected in Orderdetail

subform
using VBA?

Thank you very much

Paul


Nov 13 '05 #3
That's the one you get: the selected record. If you have selected the
second record (OrderDetailID = 158) in the subform, and then return to the
main form to perform some operation, like clicking a button to print a
report that deals only with that order, your command button code might look
something like

DoCmd.OpenReport "Order Details",,,"OrderDetailID = " &
Me![MySubform]![OrderDetailID]

where the OrderDetailID being referred to would be 158.

"Paul T. RONG" <et***@hotmail.com> wrote in message
news:Tf******************@news.chello.at...
Dave,

Thank you. What I want to do is a little bit different, I mean how to get
the OrderDetailID of the record I JUST SELECTED in the OrderDetail subform

for example:

OrderDetailID OrderID ProdID Quantity Price
157 75 012 25 105
158 75 006 10 89
159 75 003 9 78
...

Now I SELECTED the second record, the OrderDetailID is 158, but through VBA how can I get this OrderDetailID?

Does it have something to do with the action "SELECT"?

Thank you again. I appreciate your help very much.

Paul


"Dave M" <NO************@DROPTHISisland.net> дÈëÏûÏ¢ÐÂÎÅ
:UkIsd.415462$Pl.198673@pd7tw1no...
Code in the main form would refer to the subform's OrderDetailID like

this:

Me![MySubform].form![OrderDetailID]

"Paul T. RONG" <et***@hotmail.com> wrote in message
news:9I******************@news.chello.at...
Dear all,

The OrderDetail subform has following fields:

OrderDetailID OrderID ProdID Quantity Price

how to get the OrderDetailID of a record I sellected in Orderdetail

subform
using VBA?

Thank you very much

Paul



Nov 13 '05 #4
Dave,

Thank you. I agree with you, but it still doesn't want to work.

I am puzzeled.

Probably I did something wrong with the selection.

I used the default code from Access:

here is the code:

Private Sub Delete_Click()

Me.sbfrmOrderDetail.SetFocus
DoCmd.SetWarnings False
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70

DELETE OrderDetail2.*, OrderDetail2.OrderDetailID FROM OrderDetail2
WHERE
(((OrderDetail2.OrderDetailID)=[Forms]![frmOrder]![frmOrderDetail].[Form]![O
rderDetailID]));

DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
DoCmd.SetWarnings True

End Sub

OrderDetail2 is not a bound table for the subform OrderDetail.

Paul
"Dave M" <NO************@DROPTHISisland.net> дÈëÏûÏ¢ÐÂÎÅ
:G2Ksd.415807$Pl.410703@pd7tw1no...
That's the one you get: the selected record. If you have selected the
second record (OrderDetailID = 158) in the subform, and then return to the
main form to perform some operation, like clicking a button to print a
report that deals only with that order, your command button code might look something like

DoCmd.OpenReport "Order Details",,,"OrderDetailID = " &
Me![MySubform]![OrderDetailID]

where the OrderDetailID being referred to would be 158.

"Paul T. RONG" <et***@hotmail.com> wrote in message
news:Tf******************@news.chello.at...
Dave,

Thank you. What I want to do is a little bit different, I mean how to get the OrderDetailID of the record I JUST SELECTED in the OrderDetail subform
for example:

OrderDetailID OrderID ProdID Quantity Price
157 75 012 25 105
158 75 006 10 89
159 75 003 9 78
...

Now I SELECTED the second record, the OrderDetailID is 158, but through

VBA
how can I get this OrderDetailID?

Does it have something to do with the action "SELECT"?

Thank you again. I appreciate your help very much.

Paul


"Dave M" <NO************@DROPTHISisland.net> дÈëÏûÏ¢ÐÂÎÅ
:UkIsd.415462$Pl.198673@pd7tw1no...
Code in the main form would refer to the subform's OrderDetailID like

this:

Me![MySubform].form![OrderDetailID]

"Paul T. RONG" <et***@hotmail.com> wrote in message
news:9I******************@news.chello.at...
> Dear all,
>
> The OrderDetail subform has following fields:
>
> OrderDetailID OrderID ProdID Quantity Price
>
> how to get the OrderDetailID of a record I sellected in Orderdetail
subform
> using VBA?
>
> Thank you very much
>
> Paul
>
>



Nov 13 '05 #5
DAVE,

IT WORKS. SOLVED. THANK YOU VERY VERY MUCH. IF YOU TRIED TO HELP.

PAUL


"Paul T. RONG" <et***@hotmail.com> дÈëÏûÏ¢ÐÂÎÅ
:eQ******************@news.chello.at...
Dave,

Thank you. I agree with you, but it still doesn't want to work.

I am puzzeled.

Probably I did something wrong with the selection.

I used the default code from Access:

here is the code:

Private Sub Delete_Click()

Me.sbfrmOrderDetail.SetFocus
DoCmd.SetWarnings False
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70

DELETE OrderDetail2.*, OrderDetail2.OrderDetailID FROM OrderDetail2
WHERE
(((OrderDetail2.OrderDetailID)=[Forms]![frmOrder]![frmOrderDetail].[Form]![O rderDetailID]));

DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
DoCmd.SetWarnings True

End Sub

OrderDetail2 is not a bound table for the subform OrderDetail.

Paul
"Dave M" <NO************@DROPTHISisland.net> дÈëÏûÏ¢ÐÂÎÅ
:G2Ksd.415807$Pl.410703@pd7tw1no...
That's the one you get: the selected record. If you have selected the
second record (OrderDetailID = 158) in the subform, and then return to the
main form to perform some operation, like clicking a button to print a
report that deals only with that order, your command button code might

look
something like

DoCmd.OpenReport "Order Details",,,"OrderDetailID = " &
Me![MySubform]![OrderDetailID]

where the OrderDetailID being referred to would be 158.

"Paul T. RONG" <et***@hotmail.com> wrote in message
news:Tf******************@news.chello.at...
Dave,

Thank you. What I want to do is a little bit different, I mean how to get the OrderDetailID of the record I JUST SELECTED in the OrderDetail subform
for example:

OrderDetailID OrderID ProdID Quantity Price
157 75 012 25 105
158 75 006 10 89
159 75 003 9 78
...

Now I SELECTED the second record, the OrderDetailID is 158, but through VBA
how can I get this OrderDetailID?

Does it have something to do with the action "SELECT"?

Thank you again. I appreciate your help very much.

Paul


"Dave M" <NO************@DROPTHISisland.net> дÈëÏûÏ¢ÐÂÎÅ
:UkIsd.415462$Pl.198673@pd7tw1no...
> Code in the main form would refer to the subform's OrderDetailID

like this:
>
> Me![MySubform].form![OrderDetailID]
>
> "Paul T. RONG" <et***@hotmail.com> wrote in message
> news:9I******************@news.chello.at...
> > Dear all,
> >
> > The OrderDetail subform has following fields:
> >
> > OrderDetailID OrderID ProdID Quantity Price
> >
> > how to get the OrderDetailID of a record I sellected in Orderdetail > subform
> > using VBA?
> >
> > Thank you very much
> >
> > Paul
> >
> >
>
>



Nov 13 '05 #6
Dave,

I made a mistake in last post. I corrected it here:

"IT WORKS. SOLVED. THANK YOU VERY VERY MUCH. THANK ALL OF YOU WHO TRIED TO
HELP."

Paul
"Paul T. RONG" <et***@hotmail.com> дÈëÏûÏ¢ÐÂÎÅ
:rA*****************@news.chello.at...
DAVE,

IT WORKS. SOLVED. THANK YOU VERY VERY MUCH. IF YOU TRIED TO HELP.

PAUL


"Paul T. RONG" <et***@hotmail.com> дÈëÏûÏ¢ÐÂÎÅ
:eQ******************@news.chello.at...
Dave,

Thank you. I agree with you, but it still doesn't want to work.

I am puzzeled.

Probably I did something wrong with the selection.

I used the default code from Access:

here is the code:

Private Sub Delete_Click()

Me.sbfrmOrderDetail.SetFocus
DoCmd.SetWarnings False
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70

DELETE OrderDetail2.*, OrderDetail2.OrderDetailID FROM OrderDetail2
WHERE

(((OrderDetail2.OrderDetailID)=[Forms]![frmOrder]![frmOrderDetail].[Form]![O
rderDetailID]));

DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
DoCmd.SetWarnings True

End Sub

OrderDetail2 is not a bound table for the subform OrderDetail.

Paul
"Dave M" <NO************@DROPTHISisland.net> дÈëÏûÏ¢ÐÂÎÅ
:G2Ksd.415807$Pl.410703@pd7tw1no...
That's the one you get: the selected record. If you have selected the
second record (OrderDetailID = 158) in the subform, and then return to the main form to perform some operation, like clicking a button to print a
report that deals only with that order, your command button code might

look
something like

DoCmd.OpenReport "Order Details",,,"OrderDetailID = " &
Me![MySubform]![OrderDetailID]

where the OrderDetailID being referred to would be 158.

"Paul T. RONG" <et***@hotmail.com> wrote in message
news:Tf******************@news.chello.at...
> Dave,
>
> Thank you. What I want to do is a little bit different, I mean how
to
get
> the OrderDetailID of the record I JUST SELECTED in the OrderDetail

subform
>
> for example:
>
> OrderDetailID OrderID ProdID Quantity Price
> 157 75 012 25 105
> 158 75 006 10 89
> 159 75 003 9 78
> ...
>
> Now I SELECTED the second record, the OrderDetailID is 158, but

through VBA
> how can I get this OrderDetailID?
>
> Does it have something to do with the action "SELECT"?
>
> Thank you again. I appreciate your help very much.
>
> Paul
>
>
>
>
>
>
> "Dave M" <NO************@DROPTHISisland.net> дÈëÏûÏ¢ÐÂÎÅ
> :UkIsd.415462$Pl.198673@pd7tw1no...
> > Code in the main form would refer to the subform's OrderDetailID like > this:
> >
> > Me![MySubform].form![OrderDetailID]
> >
> > "Paul T. RONG" <et***@hotmail.com> wrote in message
> > news:9I******************@news.chello.at...
> > > Dear all,
> > >
> > > The OrderDetail subform has following fields:
> > >
> > > OrderDetailID OrderID ProdID Quantity Price
> > >
> > > how to get the OrderDetailID of a record I sellected in Orderdetail > > subform
> > > using VBA?
> > >
> > > Thank you very much
> > >
> > > Paul
> > >
> > >
> >
> >
>
>



Nov 13 '05 #7

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

Similar topics

4
by: YFS DBA | last post by:
How do I use VBA to insert a *new* record into a subform? I have a master form with client information, and a sub form with billing information. I want to click on a button ("Add Data") and have...
19
by: Joe Scully | last post by:
Hi all, I am having trouble with access adding a blank record to a subform everytime I finish entering data and closing the form. (The form and subform are based on the one table) When...
0
by: Carl | last post by:
I have a main form with navigation buttons on it and a label showing for example Record 1 of 15 using recordsetclone on it and eveything works fine. When I move through the records the record...
1
by: sixsoccer | last post by:
I have built a database with a <Mainform> and a <Subform>. My problem is twofold. 1. My subform is set as a continuos form with AllowAddiotions set to NO (ie. a list of Issues to the client on...
6
by: Steve | last post by:
I have a form, primary subform and secondary subform. A tab control takes up all the area of the primary subform. There are about 15 tabs on the tabcontrol. Each tab contains fields from the same...
5
by: Bob | last post by:
Hi Everybody I have a form called frmListBox that is connected to a table tblListBox. This is opened from a form called "frmInvoiceOrder" which has a subform called "zfrmInvoiceOrder" and...
5
by: tdmailbox | last post by:
I have a form with a child form. In the child form there is a list of names that can grow quite large. On the parent form I want to display the first name from the child form. I set up a test...
12
by: swingingming | last post by:
Hi, in the NorthWind sample database, when clicking on the next navigation button on the new order record with nothing on the subform (order details), we got an order with nothing ordered. How can...
2
by: alee | last post by:
I am writing a stored procedure to handle Order and OrderDetail tables. I created a tempTable physically on the database, and insert the OrderDetails into the tempTable first, then I try to use the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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.