473,805 Members | 2,042 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Easy database question

What up,

All I need to do is enter a last name in a text box, query a MSAccess
database and display the name with the corresponding columns. This is
no problem, but when there are more than one records with the same
last name, I need to click a command button to display the next record
with that name. I cant find it in any of my books and it sounds like
an easy enough question. Any help is definately appreciated.

TIA,

LedZep
Nov 20 '05 #1
5 1534
For easy questoin easy answer..:o))

I don't know what is exactly your current code but...I suppose that you are
using datasets
so, you can defiine a variable in the form class (so it will be global for
the form)

- after selecting for a new name set the variable to 1

- in the button
if myVariable < mydataset.table s("tablename"). rows.count then
myVariable +=1
display mydataset.table s("tablename"). rows (myvariable)
else
msgbox ("last one")
end if


"LedZep" <wa*********@ho tmail.com> wrote in message
news:30******** *************** **@posting.goog le.com...
What up,

All I need to do is enter a last name in a text box, query a MSAccess
database and display the name with the corresponding columns. This is
no problem, but when there are more than one records with the same
last name, I need to click a command button to display the next record
with that name. I cant find it in any of my books and it sounds like
an easy enough question. Any help is definately appreciated.

TIA,

LedZep

Nov 20 '05 #2
wa*********@hot mail.com (LedZep) wrote in message news:<30******* *************** ***@posting.goo gle.com>...
What up,

All I need to do is enter a last name in a text box, query a MSAccess
database and display the name with the corresponding columns. This is
no problem, but when there are more than one records with the same
last name, I need to click a command button to display the next record
with that name. I cant find it in any of my books and it sounds like
an easy enough question. Any help is definately appreciated.

TIA,

LedZep


I forgot to mention I'm using vb.Net
Nov 20 '05 #3
Cor
Hi Led,
This depends really how you fill the textbox with the names.
You can use a reader or a dataset or a dataview etc.
Can you send a piece of code, maybe someone can help you then.
-reading the access file
-filling the textbox
Cor
Nov 20 '05 #4
"Cor" <no*@non.com> wrote in message news:<3f******* *************** *@reader20.wxs. nl>...
Hi Led,
This depends really how you fill the textbox with the names.
You can use a reader or a dataset or a dataview etc.
Can you send a piece of code, maybe someone can help you then.
-reading the access file
-filling the textbox
Cor


If txtLast.Text <> "" Then
AddressBookData Set.Clear()
AddressBookData Adapter.SelectC ommand.CommandT ext = _
"SELECT * FROM addresses WHERE lastname = '" & txtLast.Text
& "' "

AddressBookData Adapter.Fill(Ad dressBookDataSe t)

Display(Address BookDataSet)
txtStatus.Text &= vbCrLf & "Query Successful " & _
vbCrLf

Else
txtLast.Text = "Enter last name here then press Find"
End If
When there's two records with the same last name I have to click a
command button to display the next record in the txtLast. Im lost.

Thanks,

LedZep
Nov 20 '05 #5
Cor
Hi Led.

Your dataset contains a simple table, I think you can reach it with (in a
kind of pseudo code)
\\\\\
dim i as integer
dim adress as string
adress = Addressbookdata set.table(0).ro ws(i)("adres"). tostring
/////
You can to do a for each loop with
\\\
dim dr as datarow
for each dr in addressbookdata set.table(0).ro ws
adress = dr("adres").tos tring
next
///
I hope this helps a little bit?
Cor

If txtLast.Text <> "" Then
AddressBookData Set.Clear()
AddressBookData Adapter.SelectC ommand.CommandT ext = _
"SELECT * FROM addresses WHERE lastname = '" & txtLast.Text
& "' "

AddressBookData Adapter.Fill(Ad dressBookDataSe t)

Display(Address BookDataSet)
txtStatus.Text &= vbCrLf & "Query Successful " & _
vbCrLf

Else
txtLast.Text = "Enter last name here then press Find"
End If

Nov 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1177
by: BY | last post by:
Hi, This is my code and it works fine... Dim Conn As OleDb.OleDbConnection Dim Cmd As OleDb.OleDbCommand Dim Reader As OleDb.OleDbDataReader Dim i As Integer Conn = New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data
1
4978
by: Mad Scientist Jr | last post by:
can someone explain how to simply populate a grid in .net ? the way i understand it, there is no more msflexgrid, and instead is this new control that has to be tied to a dataset, and it is a real pain to work with if you just want to throw some values in a grid and edit them with a textbox. i don't want to persist anything in a database, i just need a fast cheap and easy grid in memory that i can work with! i had functions in vb6 that...
13
1484
by: Ghislain Tanguay | last post by:
I have a compiled vb.net app and I want to give the user a choice to launch it from the start line command and pass it a parameter or not. How can I do that in my code? Is it possible? Ex. : MyApp.exe "Go"
10
270
by: Brad | last post by:
I have a Name field where I need to extract just the person's last name. I did not originally set up the database as I would have separate fields for first and last name, but this data is being pulled from an AS400 where it is just one field. I was thinking of something like trying to find the space in the name, marking that location and then trimming the beginning of the string, but I would have to start searching for the last space...
10
1644
by: cj | last post by:
I have lots of tables to copy from one server to another. The new tables have been created to match the old ones. I practiced with one table. I created the select command (select * from tableA) and Visual Basic .NET created an update command--very long as there are a lot of fields. Now there are more large tables to copy. Is there an easy way to have Visual Basic create these update commands itself for the other tables with out...
14
2473
by: google | last post by:
I am creating a new database for use within our company, that I'd like to make reasonably secure (short of a true server based solution). The back-end of a non-server based database seems to be the biggest security hole, due to the ease of opening, linking, and/or importing raw data directly from the back-end database. I've read information that indicates that locking down the back-end tables to the owner, then using RWOP queries in the...
3
1879
by: codeman | last post by:
Hi all Lets say we have two tables: Customer: Customer_number : Decimal(15) Name : Char(30) Purchase: Purchase_number : Decimal(15)
3
1159
by: Chad Dokmanovich | last post by:
As someone who's had a "fair" amount of web development experience, I shocked that I can't answer this question myself: Q: How does one maintain state and pass data across web pages and do so in a secured manner? Before you answer, let me assure you that I familiar with the normal methods 1- Passing data in the Query String 2 - Hidden form fields
2
2394
by: TonyJ | last post by:
Hello! I use VS2005 and C#. I'm looking at ADO.NET and have found some test tutorial on microsoft MSDN. It can be found on google when searching for "Walkthrough: Saving Data to a Database (Single Table)" You must have access to the Northwind sample database.
0
9596
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
10360
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...
0
10105
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...
0
9185
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7646
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...
0
6876
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();...
0
5677
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4323
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
3
3007
bsmnconsultancy
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...

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.