Hello all!
I'm trying to design and write a little application for someone
in my office, but I'm having some trouble. I have the following database
structure (Note: just some sample data, obviously):
SystemNumber SystemNumberMAX SystemName SystemKey
9007404 Windows Test 1 A
9007405 Windows Test 1 A
9007406 Windows Test 1 A
9008683 Windows Test 45 A
9008684 Windows Test 45 A
9017616 Windows Test 4595bg A
9019528 Windows Test 1 B
The SystemNumberMAX field is to be populated with the maximum SystemNumber
for a group, where a group is a unique System Key and System Name combo. The
SystemNumberMAX is only to be filled when there is more than 1 System Number
for a group. Thus, when the module is complete, the above file set should
look like this:
SystemNumber SystemNumberMAX SystemName SystemKey
9007404 9007406 Windows Test 1 A
9008683 9008684 Windows Test 45 A
9017616 Windows Test 4595bg A
9019528 Windows Test 1 B
I'm totally stumped though! I've only done stuff like affecting forms and
switchboards in Access/VBA, and wrote a VB.NET tic-tac-toe game. I'm
thinking the steps are:
1. Read the file in, and split it by commas (meaning I'll ascii-delimit it
from Access first)
2. Select the max SystemNumber # for the group and write it to a variable.
3. Delete the records in the range between the minimum and maximum
SystemNumber for the group (including the record for the max SystemNumber)
4. Write the max SystemNumber into the SystemNumberMAX field.
Can anyone offer guidance or example code for something similar?
Thanks! -Mike 3 1141
Michael,
I made a sample for you that needs a datagrid,
I have made the table, however that you can read of course direct from your
access database.
\\\\
Private Sub Form1_Load(ByVa l sender As System.Object, _
ByVal e As System.EventArg s) Handles MyBase.Load
Dim dt As New DataTable
dt.Columns.Add( "Serial")
dt.Columns.Add( "Name")
dt.Columns.Add( "Key")
Dim dtresult As New DataTable
dtresult.Column s.Add("Serial")
dtresult.Column s.Add("SerialMa x")
dtresult.Column s.Add("Name")
dtresult.Column s.Add("Key")
dt.LoadDataRow( New Object() {"9007404", "Windows Test 1", "A"},
True)
dt.LoadDataRow( New Object() {"9007405", "Windows Test 1", "A"},
True)
dt.LoadDataRow( New Object() {"9007406", "Windows Test 1", "A"},
True)
dt.LoadDataRow( New Object() {"9008683", "Windows Test 45", "A"},
True)
dt.LoadDataRow( New Object() {"9008684", "Windows Test 45", "A"},
True)
dt.LoadDataRow( New Object() {"9017616", "Windows Test 4595bg", "A"},
True)
dt.LoadDataRow( New Object() {"9019528", "Windows Test 1", "B"},
True)
Dim dv As DataView = dt.DefaultView
dv.Sort = "Name, Key"
Dim dr As DataRow
For Each drv As DataRowView In dv
If dr Is Nothing Then
dr = dtresult.NewRow
dr(0) = drv(0)
dr(1) = drv(0)
dr(2) = drv(1)
dr(3) = drv(2)
Else
If dr(2).ToString = drv(1).ToString And dr(3).ToString =
drv(2).ToString Then
dr(1) = drv(0)
Else
dtresult.Rows.A dd(dr)
dr = dtresult.NewRow
dr(0) = drv(0)
dr(1) = drv(0)
dr(2) = drv(1)
dr(3) = drv(2)
End If
End If
Next
dtresult.Rows.A dd(dr)
DataGrid1.DataS ource = dtresult
End Sub
///
I did not really check it, however the result looks for me something what it
has to be.
I hope this helps,
Cor
One quick comment: If the data is already in Access, you should do this
with a query within Access rather than exporting and processing it. If
this is an acceptable solution just say if you want help with the query
:)
Michael D. wrote: Hello all!
I'm trying to design and write a little application for someone in my office, but I'm having some trouble. I have the following
database structure (Note: just some sample data, obviously):
SystemNumber SystemNumberMAX SystemName SystemKey 9007404 Windows Test 1 A 9007405 Windows Test 1 A 9007406 Windows Test 1 A 9008683 Windows Test 45 A 9008684 Windows Test 45 A 9017616 Windows Test 4595bg A 9019528 Windows Test 1 B
The SystemNumberMAX field is to be populated with the maximum
SystemNumber for a group, where a group is a unique System Key and System Name
combo. The SystemNumberMAX is only to be filled when there is more than 1 System
Number for a group. Thus, when the module is complete, the above file set
should look like this: SystemNumber SystemNumberMAX SystemName SystemKey 9007404 9007406 Windows Test 1 A 9008683 9008684 Windows Test 45
A 9017616 Windows Test 4595bg A 9019528 Windows Test 1 B
I'm totally stumped though! I've only done stuff like affecting
forms and switchboards in Access/VBA, and wrote a VB.NET tic-tac-toe game. I'm
thinking the steps are:
1. Read the file in, and split it by commas (meaning I'll
ascii-delimit it from Access first) 2. Select the max SystemNumber # for the group and write it to a
variable. 3. Delete the records in the range between the minimum and maximum SystemNumber for the group (including the record for the max
SystemNumber) 4. Write the max SystemNumber into the SystemNumberMAX field.
Can anyone offer guidance or example code for something similar?
Thanks! -Mike
Yea, it IS already in Access... Actually, it is an Excel spreadsheet that I
put into access. However, I was thinking about writing a little VB app that
they could put on their desktop, click a button to select the file, and then
output a new/fixed file for them. The reason for that is they get the data
from an outside source on a montly basis, so it's not a 1-time thing... Does
that make sense? A query or VBA module would work either though, if I have
the query, I'm good enough (JUST!) to build the vb.net app, I think...
Thanks a lot!
Mike
"Larry Lard" wrote: One quick comment: If the data is already in Access, you should do this with a query within Access rather than exporting and processing it. If this is an acceptable solution just say if you want help with the query :)
Michael D. wrote: Hello all!
I'm trying to design and write a little application for someone in my office, but I'm having some trouble. I have the following database structure (Note: just some sample data, obviously):
SystemNumber SystemNumberMAX SystemName SystemKey 9007404 Windows Test 1 A 9007405 Windows Test 1 A 9007406 Windows Test 1 A 9008683 Windows Test 45 A 9008684 Windows Test 45 A 9017616 Windows Test 4595bg A 9019528 Windows Test 1 B
The SystemNumberMAX field is to be populated with the maximum SystemNumber for a group, where a group is a unique System Key and System Name combo. The SystemNumberMAX is only to be filled when there is more than 1 System Number for a group. Thus, when the module is complete, the above file set should look like this: SystemNumber SystemNumberMAX SystemName SystemKey 9007404 9007406 Windows Test 1 A 9008683 9008684 Windows Test 45 A 9017616 Windows Test 4595bg A 9019528 Windows Test 1 B
I'm totally stumped though! I've only done stuff like affecting forms and switchboards in Access/VBA, and wrote a VB.NET tic-tac-toe game. I'm
thinking the steps are:
1. Read the file in, and split it by commas (meaning I'll ascii-delimit it from Access first) 2. Select the max SystemNumber # for the group and write it to a variable. 3. Delete the records in the range between the minimum and maximum SystemNumber for the group (including the record for the max SystemNumber) 4. Write the max SystemNumber into the SystemNumberMAX field.
Can anyone offer guidance or example code for something similar?
Thanks! -Mike
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Fernando Perez |
last post by:
Hi all,
by reading through the docs, the func_closure attribute of function objects is
listed as writable. Yet, nowhere does it say _how_ to write to it. I am
trying to do a run-time modification of a function's closure, where I want to
modify the value of one of the variables in the closure. But the closure
appears as a tuple of 'cell' objects:
In : def wrap(x):
....: def f(y):
|
by: Sebastian Kemi |
last post by:
How should a write a class to a file?
Would this example work:
object *myobject = 0;
tfile.write(reinterpret_cast<char *>(myobject), sizeof(*object));
/ sebek
|
by: Benjamin de Waal |
last post by:
Hey all,
I'm trying to figure out how to directly write to a device in Windows.
Basically, what I'm wanting to do is create an image of a device
(specifically, a CompactFlash card that uses a filesystem Windows doesn't
recognise), store it as a file, modify it and dump it back to the card.
Currently, in version 0.001 of my program, I'm just calling "dd for
Windows" using ShellExecute - this works perfectly, but obviously this isn't...
|
by: Kristian Nybo |
last post by:
Hi,
I'm writing a simple image file exporter as part of a school project. To
implement my image format of choice I need to work with big-endian
bytes, where 'byte' of course means '8 bits', not 'sizeof(char)'. It
seems that I could use bitset<8> to represent a byte in my code --- if
you have a better suggestion, I welcome it --- but that still leaves me
with the question of how to write those bitsets to an image file as
big-endian bytes...
|
by: melanieab |
last post by:
Hi,
I'm trying to store all of my data into one file (there're about 140 things
to keep track of). I have no problem reading a specific string from the
array file, but I wasn't sure how to replace just one item. I know I can get
the entire array, then save the whole thing (with a for loop and if
statements so that the changed data will be saved), but it seems like a lot
of unnecessary reading and writing. Is there a way to directly save...
| |
by: HNguyen |
last post by:
Hi,
I have a Web application in ASP.NET. My Application allows the users upload
files into the server after checking their user names and passwords. For
each transaction, the Web program will write the information about user
name, filename upload, filesize, date and time of uploading into the log
file. (The name of the log file is constructed by Current Year and Current
Month in my program). Is there any problems with writing into the...
|
by: Paul |
last post by:
I have an application that I am tryign to modify, I never wrote the
original so need help with my modifications.
Currently the app reads and writes to an Access database with one table
'pupils' I would like to keep this table but only ever update the
records in this table, but at the same time when I create a new record
it puts the current data into a different table 'history' and then
allows me to update the data in the 'pupils' table....
|
by: Barry Flynn |
last post by:
Hi
I am working with a VB 2005 program which has been converted from VB6.
It writes data out to a flat file, with code like the following line
WriteLine(riFileNo, "Hist", lsAssetID, lsRecordType, lsXNbr, lsFiscYr,
"Beg", CStr(H.BegBalAccDepn), CStr(H.BegBalCost), CStr(H.BegBalCostReval),
CStr(H.BegBalDepCost), CStr(H.BegBalDepnReval))
The program is running from within a Virtual PC
|
by: =?Utf-8?B?QWxleA==?= |
last post by:
Hi all!
At the moment, I am transfering an application from Windows XP to Vista. As
I would like to make the application compliant with Vista, I am having some
questions:
1. ) A part of the application is writing logfile to a specified directoy
which lies under C:\Program Files\MyCompany\MyApp\Logfiles. Per default, the
write access for the "least privileged" user is not allowed in XP and Vista.
Is it okay if I modify the ACL during...
|
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: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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: 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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |