473,402 Members | 2,046 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,402 software developers and data experts.

How do I Log Multiple Values in One Message

Midzie
25
This question was split away from Deleting records from multiple tables as we don't allow multiple questions per thread - NeoPa.

I have a follow up question for Deleting records from multiple tables. I included a msgbox in every after the delete execution returning the number of records deleted in each table by inserting this code:
Expand|Select|Wrap|Line Numbers
  1. strRecordOrder = MsgBox(CStr(db.RecordsAffected) & " records from table ORDER were deleted by this SQL statement.")
  2.  
  3. strRecordSchedule = MsgBox(CStr(db.RecordsAffected) & " records from table SCHEDULE were deleted by this SQL statement.")
  4.  
  5. strRecordNote = MsgBox(CStr(db.RecordsAffected) & " records from table NOTE were deleted by this SQL statement.")
  6.  
  7. strRecordYearly = MsgBox(CStr(db.RecordsAffected) & " records from table YEARLY were deleted by this SQL statement.")
  8.  
  9. strRecordClosed = MsgBox(CStr(db.RecordsAffected) & " records from table CLOSED were deleted by this SQL statement.")
My concern now is how do I concatenate those messages so that it will be saved in my table tblLOG fieldname Remarks as like this: 2 records from table ORDER were deleted; 4 records from table SCHEDULE were deleted; 2 records from table NOTE were deleted; 100 records from table YEARLY were deleted; 150 records from table CLOSED were deleted;

Is this possible? Thanks in advance
Feb 21 '12 #1

✓ answered by ADezii

I assume you are still having problems with the Concatenation. The following Code should point you in the right direction:
Expand|Select|Wrap|Line Numbers
  1. Const conDELIMITER As String = "; "
  2. Dim strRecordOrder As String
  3. Dim strRecordSchedule As String
  4. Dim strRecordYearly As String
  5. Dim strRecordClosed As String
  6. Dim strBuild As String
  7.  
  8. strRecordOrder = CStr(db.RecordsAffected) & " records from table ORDER were deleted by this SQL statement"
  9.  
  10. strRecordSchedule = CStr(db.RecordsAffected) & " records from table SCHEDULE were deleted by this SQL statement"
  11.  
  12. strRecordNote = CStr(db.RecordsAffected) & " records from table NOTE were deleted by this SQL statement"
  13.  
  14. strRecordYearly = CStr(db.RecordsAffected) & " records from table YEARLY were deleted by this SQL statement"
  15.  
  16. strRecordClosed = CStr(db.RecordsAffected) & " records from table CLOSED were deleted by this SQL statement"
  17.  
  18. strBuild = strRecordOrder & conDELIMITER & strRecordSchedule & conDELIMITER & strRecordNote & _
  19.            conDELIMITER & strRecordYearly & conDELIMITER & strRecordClosed

3 1548
NeoPa
32,556 Expert Mod 16PB
At the time that you display these values you also need to save them in separate variables. When all are done and you're ready to log the details, simply formulate a message using all of the variables and log it.
Feb 21 '12 #2
ADezii
8,834 Expert 8TB
I assume you are still having problems with the Concatenation. The following Code should point you in the right direction:
Expand|Select|Wrap|Line Numbers
  1. Const conDELIMITER As String = "; "
  2. Dim strRecordOrder As String
  3. Dim strRecordSchedule As String
  4. Dim strRecordYearly As String
  5. Dim strRecordClosed As String
  6. Dim strBuild As String
  7.  
  8. strRecordOrder = CStr(db.RecordsAffected) & " records from table ORDER were deleted by this SQL statement"
  9.  
  10. strRecordSchedule = CStr(db.RecordsAffected) & " records from table SCHEDULE were deleted by this SQL statement"
  11.  
  12. strRecordNote = CStr(db.RecordsAffected) & " records from table NOTE were deleted by this SQL statement"
  13.  
  14. strRecordYearly = CStr(db.RecordsAffected) & " records from table YEARLY were deleted by this SQL statement"
  15.  
  16. strRecordClosed = CStr(db.RecordsAffected) & " records from table CLOSED were deleted by this SQL statement"
  17.  
  18. strBuild = strRecordOrder & conDELIMITER & strRecordSchedule & conDELIMITER & strRecordNote & _
  19.            conDELIMITER & strRecordYearly & conDELIMITER & strRecordClosed
Feb 21 '12 #3
Midzie
25
Hi Neopa/ADezii,

Earlier I made this code that's why it only returned and recorded 1; 1; 1; 1; 1; in my tblLog:
Expand|Select|Wrap|Line Numbers
  1. strRecord = strRecordOrder & strRecordSchedule & strRecordNote & strRecordYearly & strRecordClosed
I added the conDelimiter and it is working now:-) Thanks to both of you. I still added this code to return the number of records deleted in a message box:
Expand|Select|Wrap|Line Numbers
  1. MsgBox CStr(db.RecordsAffected) & " records from table Order were deleted by this SQL statement."
Feb 22 '12 #4

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

Similar topics

3
by: Henri Schomaecker | last post by:
Hi folks, does php 5 have a problem with html select lists which allow to choose multiple items? Whatever I tried I just can't get another or more than the last item selected in the list....
17
by: Roland Hall | last post by:
Is there a way to return multiple values from a function without using an array? Would a dictionary object work better? -- Roland Hall /* This information is distributed in the hope that it...
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...
16
by: Nikolay Petrov | last post by:
How can I return multiple values from a custom function? TIA
9
by: Karl O. Pinc | last post by:
I want to return multiple values, but not a set, only a single row, from a plpgsql function and I can't seem to get it to work. (I suppose I'd be happy to return a set, but I can't seem to make...
8
by: Chris A via AccessMonster.com | last post by:
I have an interesting problem that I have yet to come accross that I can't change data structure on because it is an export from filemaker I am reformatting for another dept. anyway. I have a table...
1
by: v4u2chat | last post by:
Do I need to extend any of classes from AXIS to return multiple values? I'm exposing the following method as web service through AXIS to return multiple values. public ContactAddress...
4
by: sufian | last post by:
Below is the field where user enters his/her email address and the AJAX post request is sent to the server and the user sees the message: echo("<div id=\"message\" class=\"success\">Thank you! You...
8
by: smoky_flame via DotNetMonster.com | last post by:
hi, is it possible to take multiple values(int) seperated by commas as input from textbox in C# and draw a figure using those values. e.g. drawing a simple path using 1,2,3,4 values. --...
2
by: MicaK | last post by:
Good Morning, I am new to this forum, and extremely new to VBA, so there may be a very simple explanation to this. I also apologize if I am giving you and excessive amount of detail. I have a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.