Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 16th, 2006, 04:02 PM
Registered User
Join Date: Oct 2006
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Displaying recordset into subform


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"))


End If

End Sub

Reply With Quote
  #2 (permalink)  
Old October 17th, 2006, 02:08 PM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts

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?

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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

All times are GMT -4. The time now is 01:14 AM.

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