Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 13th, 2008, 08:56 AM
Friend of Wrox
 
Join Date: Apr 2007
Posts: 110
Thanks: 1
Thanked 2 Times in 2 Posts
Send a message via MSN to ayazhoda
Default Subject: use the Form property to refer to a form

Hi All

I trying to find solution to this

When button_1 clicked

it must sets price of specific item in a sub form specific row using
following code
Forms(formA)(formB)!Price.SetFocus

But it always set prices of first row of formB instead of setting price for
3rd or 4th row of sub form

so Is there anyway I can set set focus to
formA > subform (formB) > row (2) in subform

I did find this article but it didn't help to that level

http://msdn.microsoft.com/en-us/library/aa195905(office.11).aspx


 
Old May 13th, 2008, 02:11 PM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

You didn't mention what type of sub form this is. If it is a continuous form, then the answer is no.

Can you post more info?

mmcdonal

Look it up at: http://wrox.books24x7.com
 
Old May 14th, 2008, 03:28 AM
Friend of Wrox
 
Join Date: Apr 2007
Posts: 110
Thanks: 1
Thanked 2 Times in 2 Posts
Send a message via MSN to ayazhoda
Default

This subform A is continous form,and display number of purchased items in sales order.
This subform Ahas price box text field when cursor is at this textbox and pressing F5, it display another form C which displays price list and user can pick price from that form by click Paste price. and Price will appear on subform A price box.
But problem is it always paste price in very first row of continous form instead of setting price for 2nd or any other row

 
Old May 14th, 2008, 10:37 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Some more questions:

Do you want this to be the default price in subsequent rows as they are created, or just to rows already created in the subform? It sounds like you want this price to be reflected in every row, but I am not sure if the rows are created yet.



mmcdonal

Look it up at: http://wrox.books24x7.com
 
Old May 16th, 2008, 07:49 AM
Friend of Wrox
 
Join Date: Apr 2007
Posts: 110
Thanks: 1
Thanked 2 Times in 2 Posts
Send a message via MSN to ayazhoda
Default

Top Here is Main Order form
----------------------------------------------This is continous Sub form-----------------------------------
Item No Item Name Item Decrciption Item Quantity Item Currency Item Price Item Despatch Date
 1 XXX Technical Part 10 £ 1.1(*Here you press F5)16/05/08
 2 XXX Technical part 5 $ 2.1(*Here you press F5 again to get price for this item) 17/03/09
 3 New Line New Line New Line New Line New Line
* when we press F5 subfrom pops up and click button to paste price to Item Price field




 
Old May 19th, 2008, 04:39 AM
Friend of Wrox
 
Join Date: Apr 2007
Posts: 110
Thanks: 1
Thanked 2 Times in 2 Posts
Send a message via MSN to ayazhoda
Default

In Access 2007 the F5 key executes a data refresh of the form.

Therefore when you press F5 the currentrecord in the subform is reset due to the data refresh.

To solve this you need to cancel the data refresh as follows:

Wherever you have the code in for F5

If KeyCode = 116 Then 'Do Something ------------

Replace with

Private Sub Price_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 116 Then
    'Do something
    KeyCode = 0
End If
------

I hope this will help others encounter same issue







Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing the BackColor property of a Form Qman69 Visual Basic 2005 Basics 0 March 14th, 2007 04:43 PM
splash form property changes problem Derek_05 Access VBA 1 January 17th, 2006 10:54 AM
how to refer another form khautinh General .NET 2 March 17th, 2004 01:29 PM
Form TopMost property shadowpug VB.NET 2002/2003 Basics 1 September 3rd, 2003 11:39 PM
refer to list box on another form timbal25 Access 2 August 5th, 2003 07:05 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.