473,593 Members | 2,841 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

vbscript memvar manipulation.

3 New Member
Hello,
I am trying to interface serial data logging to msaccess database.
Following macro-module-code works fine.

Function GetCPSData()

Dim ChannelNumber As Variant
Dim MyData As String
ChannelNumber = DDEInitiate("CP SPLUS", "DRIVER")
MyData = DDERequest(Chan nelNumber, "COM1_VALUE ")
DDETerminate ChannelNumber
If Len(MyData) = 0 Then Exit Function


Dim MyDB, MyTable
'Dim MyDB As Database, MyTable As Recordset
' NOTE!!! For Access Versions earlier than 2000


Set MyDB = CurrentDb()
Set MyTable = MyDB.OpenRecord set("TABLE1")

MyTable.AddNew
MyTable![serialdata] = MyData
MyTable.Update
MyTable.Close

End Function fine.

But I need to use part of mydata string

If I make following change I get fail sql statement error

Function GetCPSData()

Dim ChannelNumber As Variant
Dim MyData As String
Dim X As String
Dim Y As String
ChannelNumber = DDEInitiate("CP SPLUS", "DRIVER")
MyData = DDERequest(Chan nelNumber, "COM1_VALUE ")
DDETerminate ChannelNumber
If Len(MyData) = 0 Then Exit Function

X = Mid$("MyData", 16, 21)
Y = Mid$("MyData", 22, 25)

Dim MyDB, MyTable
'Dim MyDB As Database, MyTable As Recordset
' NOTE!!! For Access Versions earlier than 2000


Set MyDB = CurrentDb()
Set MyTable = MyDB.OpenRecord set("TABLE1")

MyTable.AddNew
MyTable![serialdata] = MyData
MyTable![x] = x
MyTable![y] = y
MyTable.Update
MyTable.Close

End Function


What is needed?
Jun 20 '07 #1
0 791

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

Similar topics

4
4834
by: John Benson | last post by:
Hi, I'm in a tightly-secured environment where I may not be allowed to use Python for some scripting work, and may have to fall back on what came with Windows 2K. I'm cracking "VBScript in a Nutshell" from O'Reilly, and have found a number of disappointments: * can't find "Introspection" in the Index * no record types, just numerically-indexed arrays, so record handling is kludgy
29
6004
by: Christopher Brandsdal | last post by:
If I have a .ASP page that runs JScript code - is it possible to include an ..ASP page that runs VBscript???
20
5960
by: Harag | last post by:
Hi All. I'm stating out doing some web developing. I was wondering which of the server side languages should I concentrate on and learn. I Know CSS, HTML, T-SQL I can look at the client javascript code and work out what it does but I can't really write it from scratch.
16
9335
by: Mike Schinkel | last post by:
Does anyone know if there are bugs in VBScript's GetRef()? I'm using VBScript Version 5.6.8515 on Win2003Server w/ASP. Sometimes it returns an object that VarType() says is a vbObject. Other times it returns VarType() is vbEmpty. This is driving me mad! Also, does anyone know what the properties and methods are for the object returned by GetRef()? TIA.
9
12325
by: Pete | last post by:
Does anyone have a simple html vbscript or other type of snippet they can share that appends a record to a access database via ADO or DAO? I would like to allow users that don't have Microsoft Access a way of adding records to a access database from a simple web page. I don't want to have to setup ODBC or anything like that I just want to put the web page on the network for anyone to access. Most of the users would use the local access...
2
1781
by: | last post by:
Hi all, I'm here to humbly request some "gimme" help from the group. I discovered the infinite wonders of VS.NET 2005 and ASP.NET 2.0 at Tech Ed a couple of weeks ago, and since returning to work I haven't looked back. Unfortunately I still have some critical functions that I originally created as vbscript functions. I need these functions to do my work. Before I can transition entirely to C#-based ASP.NET sites, I need these functions...
6
1944
by: rishabhshrivastava | last post by:
Hello All, I am using ASP.NET 2.0 and I am experiencing a problem using vbscript that is this script on client side is preventing the postback of my controls. I have a dropdownlist which is supposed to perform some fucntion when the selected index is changed, it works fine without vbscript code(when i comment out that code) but when I uncomment the code the postback dosen't happen.
0
2573
by: L'eau Prosper Research | last post by:
Press Release: L'eau Prosper Research (Website: http://www.leauprosper.com) releases new TradeStation 8 Add-on - L'eau Prosper Market Manipulation Profiling Tools Set. L'eau Prosper Market Manipulation Profiling Tools Set is a set of advanced tools that help Serious Traders analyze the market direction, market manipulative behavior and predicting the change of trend.
0
2340
by: L'eau Prosper Research | last post by:
NEW TradeStation 8 Add-on - L'eau Prosper Market Manipulation Profiling Tools Set By L'eau Prosper Research Press Release: L'eau Prosper Research (Website: http://www.leauprosper.com) releases new TradeStation 8 Add-on - L'eau Prosper Market Manipulation Profiling Tools Set. L'eau Prosper Market Manipulation Profiling Tools Set is a set of
0
1083
by: Jason Huang | last post by:
Hi, In my C# 1.1 Windows form project, I would like to export record to Excel 2000 spreadsheet Record.xls. I also need to do some data manipulation in the Record.xls. How do I call the VBScript in the C# program? Thanks for help. Jason
0
7936
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7874
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8241
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8366
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7997
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8227
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
5738
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
2383
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1469
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.