Wrox Programmer Forums
|
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 17th, 2004, 02:50 AM
Registered User
 
Join Date: May 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Navigating between Forms

Hi All,
I am very new to VBA. I am stuck up with one issue for more than a week:(.
My requirement is simple. on opening the access application, a form(Say Name=Products) should pop up with 2 fields (product ID and product Name) from a table called Products. The display should be in a table like fashion. There will be a detail button, Selecting a record and on clicking the button should take the user to another form(ProductDetails) which has some 10 fields pulling all the details of the selected record from the same table.
I am using a sub form named ProductSummary in the Form named Products to represent the data in a table fashion.
I am unable to display the details of the selected record in the second form. I have tried many things - Recordset, Recordsetclone, bookmark and what not. Since I am new to VBA, I am not sure whether I am using it correctly.
Pleez help me..
Thanks in advance,
Rakesh

 
Old May 21st, 2004, 11:28 PM
Authorized User
 
Join Date: Oct 2003
Posts: 53
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Rakesh,
Not sure if I understand 100%...but, here goes.
You can generate an SQL statement, to attach to the "RecordSource" property of the subform, to filter it accordingly.

SQL = "SELECT tblProducts.* " & _
       "FROM tblProducts " & _
       "WHERE tblProducts.ProductID =" & Me.ProductID & ";"

ProductDetails.Form.RecordSource = SQL

or, use the filter property of the subform.

ProductDetails.Form.Filter = Me.ProductID
ProductDetails.Form.FilterOn = True

I believe, my syntax is correct in both cases.
I used "ProductDetails" to reference the subform, it should be whatever you called it on the main form, not necessarily its actual name.
Hope this helps Rakesh, good luck!








Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem in navigating kk2ka4 XSLT 1 November 12th, 2008 01:45 AM
Navigating Recordsets w/out specifying name Tethys Access VBA 7 December 5th, 2005 04:47 PM
Navigating records in a database don baroo Classic ASP Databases 3 December 8th, 2004 07:09 AM
navigating a dataset ranakdinesh BOOK: Professional C#, 2nd and 3rd Editions 4 June 1st, 2004 11:37 PM
Navigating thru DataGrid Object chiefouko VB Databases Basics 0 July 24th, 2003 04:56 AM





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