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

Append values returned from a sub into a table

374 256MB
I am using a sub routine which returns values in the following way (it is just looking at the ldb of the access file):

W7BC-P1595
Admin
True
Null

If there are two users in the back end it will show:

W7BC-P1595
Admin
True
Null
W7BC-P1534
Admin
True
Null

Each line of the above is looped through so each is created in turn, the above is from my immediate window.

I want to place these values in to a table set up as follows with sql:

Expand|Select|Wrap|Line Numbers
  1. CREATE TABLE tblLDBViewer (Computer TEXT(255), Username TEXT(255), Connected? TEXT(255), Suspect? TEXT(255))
How would I get my data to be sent to this table in the correct order?

So W7BC-P1595 goes in to computername, Admin in username, True in Connected? and a Null in Suspect. Then, if there are two people in the database the code will return a new line for the second person.

I assume this could be done with some form of loop but I cant figure it out.

This is the current loop I have:

Expand|Select|Wrap|Line Numbers
  1. With rst    'fills Recordset (rst) with User List data
  2.   Do Until .EOF
  3.     intUser = intUser + 1
  4.       For Each fld In .Fields
  5.         varValue = fld.Value
  6.           'Some of the return values are Null-Terminated Strings, if
  7.           'so strip them off
  8.  
  9.           If InStr(varValue, vbNullChar) > 0 Then
  10.             varValue = Left(varValue, InStr(varValue, vbNullChar) - 1)
  11.           End If
  12.           Debug.Print varValue
  13.           strUser = strUser & ";" & varValue
  14.  
  15.       Next
  16.         .MoveNext
  17.   Loop
  18. End With
The varvalue debug.print is the list from above. I was originally going to have this in a listbox but I need to be doing a bit more with the data so a temporary table will be needed.
Nov 18 '10 #1
1 1229
NeoPa
32,556 Expert Mod 16PB
Subroutines don't return values. Procedures that can, are called functions (or methods for within a class).

Can we see the code of your function. How that works will determine how the calling code would be able to process the data.

Have a look at Access VBA DAO Recordset Loop Using Two Recordsets for some basic code that includes the sort of thing you will need.

Lastly, I would suggest the table would need to be a permanent table, but would be cleared and repopulated as and when required.
Nov 18 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Larry Woods | last post by:
I have created a table that I want to fill with calculated values. I have given ID's to each cell. This must NOT be the way since I can't address these ID's. How do I store values in table cells...
5
by: Homer Simpson | last post by:
Hi All, I'm trying to write a method where I pass three arguments and the method returns six values. All the values will be doubles. First, is it possible to get multiple values returned by a...
1
by: satish mullapudi | last post by:
Hi, I am using DB2 v8.2 & jdk 1.4. 1. I have a java program which returns an array which contains 1 to 5 numbers. The code: public class ArrayTest { public static final int ARRAY_SIZE = 5;...
13
by: technocraze | last post by:
Hi guys, I have an issue with incrementing a counter in a table using VB in MS Acess environment. Below mentioned is an instance. Implementation logic Table fields Serialno = pk Datatype...
7
by: Tobiah | last post by:
I wanted to do: query = "query text" % tuple(rec.append(extra)) but the append() method returns none, so I did this: fields = rec fields.append(extra) query = "query text" % tuple(fields)
7
by: riceking | last post by:
Is it possible to do the following and if so, how? In one table, I have a list of email addresses I know are bad and no longer work. Another table has a list of companies with contact people,...
4
by: rocksters | last post by:
HI , Can u tell how to add the two values returned by two different fuctions in different cases of switches????
1
by: san1014 | last post by:
Hi I have a table SQL> select * from nodes; NODE_ID NODE_NAME -------------------- ------------------------------ N1 Kothhapet N2 Nagole...
3
by: Francogrex | last post by:
Hello, I am new to C++, have some knowledge of programming in splus(statistics). I am trying to append values output by a loop (code below) into a vector (by appending value), that I can eventually...
4
by: whatsuppussycat | last post by:
I want to be able to SUM the values returned using the TOP 5 and COUNt statements. So far I've tried from many angles and can't get it to work, very frustrating! Here is my code: SELECT TOP 5...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: 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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.