|
-
Feb 22nd, 2003, 12:52 AM
#1
Thread Starter
Hyperactive Member
Find Method
Hi Everyone
I'm creating a database (gratis) for our local food bank, and its
my first real db.
I've got most of it hooked up and ready to go, but I've run
into a snag. (the part I thought was going to be easy!)
I've looped through the data base and loaded up names into
a listbox. I'd like the volunteers to be able to select a name
from the listbox, click a command button and bring up the
record from the database (Access).
I'm having syntax meltdown ....Can anyone help me?
Thank you
-
Feb 23rd, 2003, 10:43 AM
#2
Re: Find Method
Originally posted by Rocketdawg
Hi Everyone
I'm creating a database (gratis) for our local food bank, and its
my first real db.
I've got most of it hooked up and ready to go, but I've run
into a snag. (the part I thought was going to be easy!)
I've looped through the data base and loaded up names into
a listbox. I'd like the volunteers to be able to select a name
from the listbox, click a command button and bring up the
record from the database (Access).
I'm having syntax meltdown ....Can anyone help me?
Thank you
Are you using ADO or DAO?
In the button click event,
VB Code:
Private Sub Command1_Click()
dim thename as string
thename = list1.text
'then you would call a procedure using [thename] in the query string to the database
End Sub
Where exactly are you running into problems?
-
Feb 23rd, 2003, 01:23 PM
#3
Thread Starter
Hyperactive Member
ADO troubles
Mendhak (thank you for the reply!)
I'm using an ADO object.
I should clarify....
I can load the fields into where I need them, but the problem is
this:
If I have a Field called 'Last Name', how do I loop thru and
load the actual names in the field? That's the part that has
me scratching my head.
In the Field called 'Last Name', are the names in a row that
I can loop through?
Sorry to seem overly thick, but I'm really new at ADO.
Thanks
-
Feb 24th, 2003, 12:05 AM
#4
Re: ADO troubles
Originally posted by Rocketdawg
Mendhak (thank you for the reply!)
I'm using an ADO object.
I should clarify....
I can load the fields into where I need them, but the problem is
this:
If I have a Field called 'Last Name', how do I loop thru and
load the actual names in the field? That's the part that has
me scratching my head.
In the Field called 'Last Name', are the names in a row that
I can loop through?
Sorry to seem overly thick, but I'm really new at ADO.
Thanks
OK, this is what I have understood: you want to loop through all the last name records and put them in a list box.
VB Code:
objrs.movefirst
Do While not objrs.eof
List1.Additem objrs.fields("lastname")
objrs.movenext
Loop
Is that what you're looking for?
If I failed to answer your question, my apologies, that is what I have understood. Perhaps you should post whatever code you have so we can get a better understanding of where you're failing.
-
Feb 24th, 2003, 08:17 AM
#5
Thread Starter
Hyperactive Member
It came to me in a vision....
Mendhak,
Thanks again for the reply. I got it figured out, and yes
what you posted was right on the money.
I couldn't get it through my head that in order to get the
value of a field, you've got to (Move or MoveNext) to the
right page in the recordset. Duh. Buddha-like enlightenment
at 2 in the morning.....
Anyway, thank you again for the assistance.
RG
-
Feb 24th, 2003, 09:23 AM
#6
Lol@buddha.
YW.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|