Hey guys i have a question am having trouble in displaying record in a list box, what i want to achieve is this... i have 2 check boxes, checkbox1 is name MEASLES and checkbox is name "CHICKEN POX". i have a database name MEDICALDB and has 4 tables named STUDENT NUMBER, NAME, CHIKEN POX AND MEASLE..
i have this example database record:
Student Number Name Chiken Pox Measles
200013253 Darrel NO NO
200013254 Gary YES NO
200013255 Norman NO YES
200013256 Larry YES YES
The scenarion i wanted to search for the names that have value of YES in the Chicken Pox Field and display the name in a listbox..
I'am having trouble on how to implement it in my program so far i have this codes: -
Dim rsShowrec1 As New ADODB.Recordset
-
Dim cnn As New ADODB.Connection
-
-
Set cnn = New ADODB.Connection
-
cnn.ConnectionString = _
-
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
-
"Data Source=" & App.Path & "\MedicalDB.mdb;"
-
cnn.Open
-
-
If check1.value = 1 Then
-
Label1.caption = "YES"
-
-
On Error Resume Next
-
rsShowrec1.Source = "SELECT * FROM MecidalData where [CHICKEN POX] = ' " & Label1.caption & " '
-
rsShowrec1.Open , cnn, adOpenStatic, adLockOptimistic
-
-
If rsShowrec1.EOF <> True Then
-
List1.AddItem rsShowrec1.Fields("Name").Value
-
rsShowrec1.MoveNext
-
end if
-
End Sub
-
So far its not working... Any help will do... Thank you... i hope your getting wat i want to achieve... By d way am using ADODB for my database connection.
7 1751
try this -
sqlstr= "SELECT * FROM MecidalData where [CHICKEN POX] = ' " & Label1.caption & " '
-
rsShowrec1.Open sqlstr, cnn, adOpenStatic, adLockOptimistic
-
-
Do While rsShowrec1.EOF = False
-
List1.AddItem rsShowrec1!name
-
rsShowrec1.MoveNext
-
Loop
-
My guess is, this is VB6 - right?
So what's wrong with your current code? "Not working" is pretty vague. Is it producing an error? If so, what error and at what line of code? If not, in what way does it not match what you expect?
Theres no error on runtime my problem is the name are not populated in the list box. i will try another sequence. ill keep you posted . Many thanx.
Hello, ive tried what debasisdas suggestion, no sad to say no luck, there no error on runtime, but it doesnt populate my database record in the listbox and it has infinite loop.
Any more suggestion am badly need to finish this task so that my system will be implemented... Thank you..
hi
the problam is in your query. if datatype of the [CHICKEN POX] is YesNo then
then your query must like this
SELECT * FROM MecidalData where [CHICKEN POX] = " & iif(Label1.caption = 'Yes',True,False)
regards
manpreet singh dhillon hoshiarpur
Thank you for all the advice and tips. I figured out how I can populate database records in my list box, I just used the long method procedure.
Now, I have a new question for you guys. Now that I'm able to populate database records in my lists, what I wanted to do now is to populate all the items in my lists to a datareport to produce a hard copy.
Can you give me sometimes, I'm nearly close in finishing my Medical and Dental Record System.
Thank you, it's good to belong here... hooray!
Hi,
In DataEnvironment, add a Connection object and set the parameters to the database and test the connection. Right click Conn and add a Command object. Change the SQL query as "Select * From MyTable".
Add a new DataReport to the project. Open the Command Object node. You will see all the fields. Drag them and drop them on the DataReport. Adjust the lines. And in VB6 to show the report: DataReport1.Show
Regards
Veena
Sign in to post your reply or Sign up for a free account.
Similar topics
by: michael |
last post by:
hi,
i have to do a medium sized project using php. i'm new to php but i
quite like the model-view-controller pattern.
so i was thinking to use the following combination of frameworks:
mojavi,...
|
by: Marcin Grzębski |
last post by:
Hi All!
I can't find any good equivalent of VB6 params from samples
which should be used as a 2nd and 3rd parameter in method:
Connection.OpenSchema(ADODB.SchemaEnum schema
, object criteria...
|
by: Shi Mu |
last post by:
How to run a function to make become ,1,4],]?
Thanks!
|
by: Swroteb |
last post by:
Hi there,
I've got a reasonably sized list of objects that I'd like to pull out
all combinations of five elements from. Right now I have a way to do
this that's quite slow, but manageable. I...
|
by: Farmer |
last post by:
Hi Folks,
I have been trying for a whole day yesterday to find out how to do this
and found nothing here (maybe I didn't look well enough I dont know).
But here it is I found some code on msdn...
|
by: Fresh_Air_Rider |
last post by:
Hi
In the "good old" Classic ASP days, I used to stream records from a SQL
Server database out to the user's browser in CSV format by using a
combination of COALESCE and the ADODB.Stream object....
|
by: rn5a |
last post by:
A Form has 2 select lists. The 1st one whose size is 5 (meaning 5
options are shown at any given time) allows multiple selection whereas
the 2nd one allows only 1 option to be selected at a time.
...
|
by: ADezii |
last post by:
For this Tip, we will show you an extremely handy, multi-user, feature of Jet that allows you to manage Users more effectively. You can create a special, provider-specific Recordset in ADO that...
|
by: gismar |
last post by:
hi!!
i just started with access for my job in a small translation agency,
i have a form where i can select a language combination, based on the combination i want to load a list of...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
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...
|
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,...
|
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,...
|
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...
|
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...
| |