Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 24th, 2004, 03:45 PM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default Using VBA to define query fields???

Hi,

   I am still trying to resolve my IP address issue.

   I have a table with computer information, including the computer's IP Address.

   I have another table with subnets, and the location of the subnets.

   I need a regular expression, or some way to use VBA to define a field in one query to show the subnet of the computer's IP address by parsing the IP Address.

   As an example, this code works in VBScript:

'==============================================
strIP = "192.168.0.100"

NewArray = Split(strIP, ".")
strOct01 = NewArray(0)
strOct02 = NewArray(1)
strOct03 = NewArray(2)

strSubnet = strOct01 & "." & strOct02 & "." & strOct03

WScript.Echo strSubnet
'===============================================
This breaks the IP Addresss into its octets, and then concatenates them with periods to display the subnet (192.168.0)

I need to run a query that looks like this...

'===============================================
SELECT tblComputer.ComputerName, tblComputer.UserName, tblComputer.DHCP
FROM dbo_tblComputer;
'===============================================

I had used "Subnet:(Left([DHCP], 9))" to create a subnet, but some subnets are 10 or more characters. So I didn't think I could use regular expressions.

Once I have the subnet I will compare it to the subnet location table, but I need to get the value to come back as "192.168.0" or "192.16.0" or "192.168.104" etc consistently.

So the issue is a regular expression that will parse this, or a way to use VBA to populate a query field.

THANKS!

mmcdonal
__________________
mmcdonal

Look it up at: http://wrox.books24x7.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
Renaming fields in access table using VBA imaley Access VBA 13 August 13th, 2009 02:22 PM
VBA code to Search All Text Fields on a form dezmond2 BOOK: Access 2007 VBA Programmer's Reference ISBN: 978-0-470-04703-3 1 July 7th, 2007 11:58 AM
How to add fields to an existing table using VBA donrafeal Access VBA 3 March 22nd, 2006 06:11 PM
Fields object syntax in VBA query stepdev Access VBA 11 March 3rd, 2006 04:53 PM
How to replace pivot table data fields using VBA? rstober Excel VBA 2 August 19th, 2005 06:06 AM





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