473,378 Members | 1,375 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,378 software developers and data experts.

VBA Tutorial & Question

Two items:

1) Where can I find a good online Access VBA tutorial (I've done a fair
amount of VBA programming in Excel)

2) I need to query a single column in my database and output the values,
200 per row. Is there an easy way to do this?

--
Alan Little
Phorm PHP Form Processor
http://www.phorm.com/
Sep 18 '06 #1
4 3186
Carved in mystic runes upon the very living rock, the last words of Alan
Little <al**@n-o-s-p-a-m-phorm.comof comp.databases.ms-access make plain:
2) I need to query a single column in my database and output the values,
200 per row. Is there an easy way to do this?
A little more detail: these are ID numbers; the client wants to paste them,
200 at a time, separated by commas, into a field on a web site search form.

--
Alan Little
Phorm PHP Form Processor
http://www.phorm.com/
Sep 18 '06 #2
Try something like this:

Sub Concat()
Dim MyDB As database
Dim MyRS As Recordset
Dim MyNewRS As Recordset
Dim strManyClientIds As String
Dim intRecordsProcessed As Integer
Set MyDB = CurrentDb()
Set MyRS = MyDB.OpenRecordset("tblClientDB", dbOpenSnapshot)
Set MyNewRS = MyDB.OpenRecordset("tblOutPut", dbOpenDynaset)
Do While Not MyRS.EOF
strManyClientIds = ""
intRecordsProcessed = 0
'** This concatinates the IDs from the next 200 records into a string
that is comma delimted
Do Until intRecordsProcessed = 200 Or MyRS.EOF
strManyClientIds = strManyClientIds & ", " & MyRS!fldClientID
intRecordsProcessed = intRecordsProcessed + 1
MyRS.MoveNext
Loop
'** This adds a new record to the Output table and adds the comma
delimited string to the appropriate field
MyNewRS.AddNew
MyNewRS!FldManyClientIDs = strManyClientIds
MyNewRS.Update
Loop

Set MyDB = Nothing
Set MyRS = Nothing
Set MyNewRS = Nothing

End Sub

The string being built will require a memo field in Access for storage
"Alan Little" <al**@n-o-s-p-a-m-phorm.comwrote in message
news:Xn**************************@216.196.97.131.. .
Two items:

1) Where can I find a good online Access VBA tutorial (I've done a fair
amount of VBA programming in Excel)

2) I need to query a single column in my database and output the values,
200 per row. Is there an easy way to do this?

--
Alan Little
Phorm PHP Form Processor
http://www.phorm.com/

Sep 18 '06 #3
Carved in mystic runes upon the very living rock, the last words of
Kc-Mass of comp.databases.ms-access make plain:
"Alan Little" <al**@n-o-s-p-a-m-phorm.comwrote in message
news:Xn**************************@216.196.97.131.. .
>>
2) I need to query a single column in my database and output the
values, 200 per row. Is there an easy way to do this?

Try something like this:

Sub Concat()
[snip]
End Sub

The string being built will require a memo field in Access for storage
Thanks. One silly question: how do I invoke it? I tried just running it
from the editor, but it dies on this line:

Set MyDB = CurrentDb()

saying, "ActiveX component can't create object".

--
Alan Little
Phorm PHP Form Processor
http://www.phorm.com/
Sep 18 '06 #4
Check your References under Menu item -Tools:References from within the
editor.
I tried it here and it runs with the following references:

Visual basic for Applications
Microsoft Access 9.0
Microsoft DAO 3.6 Object Library
OLE Automation
Microsoft Visual Basic for Extensibility 5.3

"Alan Little" <al**@n-o-s-p-a-m-phorm.comwrote in message
news:Xn**************************@216.196.97.131.. .
Two items:

1) Where can I find a good online Access VBA tutorial (I've done a fair
amount of VBA programming in Excel)

2) I need to query a single column in my database and output the values,
200 per row. Is there an easy way to do this?

--
Alan Little
Phorm PHP Form Processor
http://www.phorm.com/

Sep 18 '06 #5

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

Similar topics

1
by: Bob Kochem | last post by:
Can someone point me at a tutorial or other reference on how VB 5 &/or 6 consumes memory and what its limits are? I have a program in VB5 that has been around a while and grown quite a bit. I...
0
by: Guennadi V. Vanine | last post by:
I followed IIS ASP Tutorial examples on isolated from net Windows XP Professional available at http://localhost/iishelp/iis/htm/asp/AspTut02.htm In order to run DisplayAds.asp the example on...
15
by: binnyva | last post by:
Hello Everyone, I have just compleated a JavaScript tutorial and publishing the draft(or the beta version, as I like to call it) for review. This is not open to public yet. The Tutorial is...
9
by: julie.siebel | last post by:
Hello all! As embarrassing as it is to admit this, I've been designing db driven websites using javascript and vbscript for about 6-7 years now, and I am *horrible* at form validation. To be...
14
by: Arne | last post by:
A lot of Firefox users I know, says they have problems with validation where the ampersand sign has to be written as &amp; to be valid. I don't have Firefox my self and don't wont to install it only...
1
by: xahlee | last post by:
Elisp Tutorial: Make Google Earth Xah Lee, 2006-12 This page shows a example of writing a emacs lisp function that creates a Google Earth file, and creates a link to the file, as well a link...
0
by: Vijay | last post by:
Prep Courses for International Certifications, CSTE & CSQA & ISEB & ISTQB &Business Analyst & SOA Certifications in HYDERABAD. After receiving overwhelming response to our last 50+ batches, ...
0
by: David Goodger | last post by:
Thanks to all the proposal authors so far, we have received lots of proposals for PyCon talks & tutorials. But we'd like to have even more. Alas, the proposal submission deadline should have been...
0
by: Omar Abid | last post by:
Reason of this project: The Microsoft.VisualBasic.Interaction class exposes many useful commands and methods that were available in Visual Basic like AppActivate, Beep, Callbyname... This...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.