Ok, I'm back again.
I've got the following table.
TableName = tblOriginal
uid - self explanatory
firstName - self explanatory
lastName - self explanatory
groupMaster - contains a numeric string containing 21 digits.
My question surrounds the 'groupMaster' field.
I need the first four groups of three, from the right to be inserted into another existing table, along with the other corresponding fields.
sample string from groupMaster: 333444555666777 888999
Looking at the above string:
999 will be inserted into tblMaster.group 3
777 will be inserted into tblMaster.group 2
666 will be inserted into tblMaster.group 1
*all other fields will insert into corresponding names.
TableName = tblMaster
uid
firstName
lastName
groupMaster
group1
group2
group3
As always......... ...thanks in advance!!!
7 2029 ADezii 8,834
Recognized Expert Expert @artemetis
Assuming a precise, 21-digit Format, a code-based approach would look something like this: - Dim MyDB As DAO.Database
-
Dim rstOriginal As DAO.Recordset
-
Dim rstMaster As DAO.Recordset
-
-
Set MyDB = CurrentDb
-
Set rstOriginal = MyDB.OpenRecordset("tblOriginal", dbOpenForwardOnly)
-
Set rstMaster = MyDB.OpenRecordset("tblMaster", dbOpenDynaset)
-
-
With rstOriginal
-
Do While Not .EOF
-
rstMaster.AddNew
-
rstMaster![GroupMaster] = ![GroupMaster]
-
rstMaster![Group4] = Right(![GroupMaster], 3)
-
rstMaster![Group3] = Mid(![GroupMaster], 16, 3)
-
rstMaster![Group2] = Mid(![GroupMaster], 13, 3)
-
rstMaster![Group1] = Mid(![GroupMaster], 10, 3)
-
rstMaster.Update
-
.MoveNext
-
Loop
-
End With
-
-
RefreshDatabaseWindow
-
-
rstOriginal.Close
-
rstMaster.Close
-
Set rstOriginal = Nothing
-
Set rstMaster = Nothing
Thanks Folks!
ADezii - how does your code process a blank location, or would it?
For example(s):
"777 999"
"777888 "
where each block of missing values has three null spaces?
I'm seeing that in many of my records.
Thanks again in advance!!!
ChipR 1,287
Recognized Expert Top Contributor
Edited this out so you don't accidentally do it before reading subsequent posts.
ChipR 1,287
Recognized Expert Top Contributor
Sorry, ignore that last suggestion. I though from your example that the items had spaces between them, but a null value is a different story. If you don't use [ code ] tags, your multiple spaces get turned into single spaces.
ADezii's code will still work fine in this case. Blanks are treated much differently from NULLs.
Thanks ChipR.
Yeah, the data that I've been given is a MESS.
In that field of 21, if there is no three digit value, there are three spaces.
It's like 7 fields of three in one field. Grrrrrrrrrrr!
NeoPa 32,579
Recognized Expert Moderator MVP
This should be an easy SQL job : - INSERT INTO tblMaster
-
(uid,
-
firstName,
-
lastName,
-
groupMaster,
-
group1,
-
group2,
-
group3)
-
-
SELECT uid,
-
firstName,
-
lastName,
-
groupMaster,
-
Mid([groupMaster],10,3) AS group1,
-
Mid([groupMaster],13,3) AS group2,
-
Mid([groupMaster],19,3) AS group3
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Aleander |
last post by:
Hi!
I have to write the records of a vector in a file, e and then open this file
to extract the record to refill the vector.
My program has two class: Visita(Appointment) and Data(date). The second one
is used in the first one such as a field. I wrote the scrivi() function to
write the record in a file called "archivio.txt" and it works fine.
The I wrote the carica() function to load the records that I have placed on
the file, but I...
|
by: Michael Hill |
last post by:
Hi, folks.
I am writing a Javascript program that accepts (x, y) data pairs from
a text box and then analyzes that data in various ways. This is my
first time using text area boxes; in the past, I have used individual
entry fields for each variable. I would now like to use text area
boxes to simplify the data entry (this way, data can be produced by
another program--FORTRAN, "C", etc.--but analyzed online, so long as
it is first...
|
by: v0lcan0 |
last post by:
Any help on extracting the time part from the datetime field in SQL
database.
even though i had entered only the time part in the database when i
extract the field it gives me only the date part. i’m using Vb.net
datagrid as a front end.
any assistance appreciated!! :?:
--
|
by: gRizwan |
last post by:
Hello all,
We have a problem on a webpage. That page is sent some email data in
base64 format. what we need to do is, decode the base64 data back to
original shape and extract attached image from it.
Any help will be highly appriciated.
Thanks
|
by: Branden |
last post by:
hi guys,
i was wondering if it is possible to extract selected words in a
field to be put in different fields automatically. Do i have to write
the code in vb?
This is what im trying to do. Write now, i have emails that i
receive in outlook and i want to transfer them into a database. I
realized that i could export this. however, the BODY section of the
email is exported as one field. As the email i receive is a template
and it is...
| |
by: Dickyb |
last post by:
Extracting an Icon and Placing It On The Desktop (C# Language)
I constructed a suite of programs in C++ several years ago that handle my
financial portfolio, and now I have converted them to C#. The only
significant problem that I have encountered in the conversion is this one -
extracting an icon from the 'KTEntryPoint' program into the software suite
and placing that icon on the PC Desktop.
|
by: glenn |
last post by:
Hello,
I am using the following code to pull data from my dataset in Page_Load
Dim str As String
Dim ds As System.Data.DataSet
Dim dt As System.Data.DataTable
Dim dr As System.Data.DataRow
Dim dc As System.Data.DataColumn
|
by: Debbiedo |
last post by:
My software program outputs an XML Driving Directions file that I need
to input into an Access table (although if need be I can import a dbf
or xls) so that I can relate one of the fields (fromStop) and its
associated driving directions back to a relational database. I have
asked my software vendor for solutions but thus far they have not come
up with anything. I am totally unfamiliar with XML so I am struggling
with how to do this. I have...
|
by: Keith Wilby |
last post by:
On a bit of a no-brainer with this. I have a field containing composite
data which is imported from another system. Here's a sample:
TECH_ACT=2HL91002:TGT_START=12-NOV-07:CAM_CODE=AKJBA:DA=HL:WBS=DES071702:
I'd like to extract the element CAM_CODE=AKJBA but the string after the "="
sign can vary in length between rows. Does anyone have a code snippet in
their library that might do this ... or is there a built-in function that I...
|
by: TYR |
last post by:
I have a large dump file that originated in a MySQL db; I need to get
it into an SQLite file.
Various options are suggested around the web; none of them seem to
work (most failing to import the thing in the first place). So I
removed the assorted taggery from each end, leaving just a big text
file taking the following format:
('value', 'value', 'value, 'value'),
('value','value','value','value')...
|
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...
| |
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...
|
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,...
|
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...
|
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...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |