Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access 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 October 16th, 2006, 04:02 PM
Registered User
 
Join Date: Oct 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Displaying recordset into subform

Hi

I am pretty new to access programming and I am having a problem in displaying may recordset in the subform my subform is compose of datasheet I can write a query but I want to display the result in my subform here is the code sample, I have a field called PDpartNo that has 14 chars. but seems like SUBSTRING won't work in access I used Left but it say wrong number of parameter. First I wanted to know how do I display result my subform , I can only display it using messagebox but not in the datasheet, second how do I get only a certain char aside from using substring please advice

Thankns is advance

Private Sub chkATO_Click()
Dim rs As DAO.Recordset
Dim db As DAO.Database
Dim str As String
Dim rs1 As DAO.Recordset


If Me.chkATO = -1 Then

str = "SELECT DISTINCT Left(PDPartNo,1,10) FROM tbl150l" -- I select all distinct
MsgBox (str)
Set db = CurrentDb()
Set rs = db.OpenRecordset(str)
Do While rs.EOF = False

 MsgBox (rs("PDPartNo"))
 rs.MoveNext




Loop


End If

End Sub

 
Old October 17th, 2006, 02:08 PM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Why don't you create the query in the query designer, then create a form based on the query, then drop the form on top of the main form (to make it a subform) and then link the parent and child fields?



mmcdonal





Similar Threads
Thread Thread Starter Forum Replies Last Post
Subform not displaying values after adding updates jlangdon Access 1 April 23rd, 2008 03:00 PM
How to bind Recordset to an Access Subform in VB? fcortes BOOK: Access 2003 VBA Programmer's Reference 1 March 1st, 2008 08:39 PM
Subform not displaying data hikinfool Access 8 February 24th, 2006 06:11 PM
ADODB.Recordset (0x800A0CB3)Current Recordset does tks_muthu Classic ASP Databases 0 June 16th, 2005 07:22 AM
Filter Subform B Based on Field in Subform A SerranoG Access VBA 3 June 18th, 2004 12:23 AM





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