Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Reading Data From Database Into Listview


Hi.. I am new to vb. May I know how to show the data from database into listview? for example: ID, Name, gender etc.. and then when i select a particular record from the listview, it will pass the id to me, so that i can proceed to the edit form. Do anybody have an idea on this? Thanks in advance..




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Trouble Reading Data From Database
I have this code currently to read data from the database from one field for all the records and store the value from each record in one variable in a dynamic array.


Code:
Dim staff_Array() As Integer
Dim itemcount As Integer

itemcount = 0
HourData.Recordset.MoveFirst
Do Until HourData.Recordset.EOF
hour_value = Hours
itemcount = itemcount + 1

ReDim Preserve staff_Array(itemcount) As Integer
staff_Array(itemcount - 1) = hour_value

HourData.Recordset.MoveNext
Loop

I was given some pseudo code to help me along to develop this. The HourData refers to my data control on the form which links to the database and the table within that.

Can anyone help me becuase when i run it i get an error object variable or with block variable not set and this highlights hourdata.recordset.movefirst.

I am really not sure what to do, could someone help me with this code or some code that will do what i need.

Reading Data From MySql Database ?
Hi,

I'm new to mysql,
and I need to read data from mysql database using VB6.
I found code to connect to database (I've installed MyODBC 3.51.06),
but I would appriciate some example on how to read data, e.g. populate datagrid control from database , or something similar ?

Hope you can show me some example or direct me to some tutorial.

thanx,
stojan

Reading Data From Database && Adding To Combo
Is it possible to add all files from one field in a table to a combo box in vb?


Eg. I Have 20 motors in a table, I want to take the names of the motors (Motor_ID) and add these to a combo box?

Is that possible?

Reading Data From Database && Adding To Combo
Is it possible to add all files from one field in a table to a combo box in vb?


Eg. I Have 20 motors in a table, I want to take the names of the motors (Motor_ID) and add these to a combo box?

Is that possible?

Reading In Data From An Access Database Table
hi

When data is read in from a currency field or an integer field (or any other type of field) of an Access database recordset, is the data type of the field the same as it is in the original Access database table?

thanks

Reading Text File And Putting Data Into Access Database
I am developing a software in VB 6.0 and I have the records arranged in columns in .txt file that I have to put in the Access table to be prosesed later.The records in the text file are comma seperated. How to read that file through VB 6.0 and put it the table of Access 2000? please help me with the code if possible.

Reading Data From 2 Tables In One Database Then Dumping It Into Combo Boxes - HELP PLEASE
I am using microsoft access as my database, this database contains two tables 1/email_reference_table and 2/department_reference_table. I then want to read the data from each table into seperate combo boxes.

The problem I am having is that I can read the email reference table data ok but not the department table data.

I have attached a zipped up file containing source code and database.

Can anyone help?

Regard
M

Data From Listview Into Database?
Hi,
i am using dao to work with an access database.
on my form i have a listview which the user can input to, when they click a save button i want to place the contents of the listview into a table in the database.
Any tips on making this happen?
Here is my code so far, but i get an error when executing it (Argument not optional)


Code:

For i = 1 To ListView1.ListItems.Count Step 1
With namesrs
.AddNew
!names_id = Nbooking_id + 1
!booking_id = Nbooking_id
!Name = ListView1.ListItems.Item.Text
!Ins_A = ListView1.ListItems(i).ListSubItems.Item.Text
!Ins_C = ListView1.ListItems(i).ListSubItems.Item.Text
!Ins_S = ListView1.ListItems(i).ListSubItems.Item.Text
!Ins_X = ListView1.ListItems(i).ListSubItems.Item.Text
!Coach = ListView1.ListItems(i).ListSubItems.Item.Text
!Air = ListView1.ListItems(i).ListSubItems.Item.Text
!Train = ListView1.ListItems(i).ListSubItems.Item.Text
!Other = ListView1.ListItems(i).ListSubItems.Item.Text
!Type = ListView1.ListItems(i).ListSubItems.Item.Text
!Room = ListView1.ListItems(i).ListSubItems.Item.Text
!Ski = ListView1.ListItems(i).ListSubItems.Item.Text
!Board = ListView1.ListItems(i).ListSubItems.Item.Text
!Boots = ListView1.ListItems(i).ListSubItems.Item.Text
!Pass = ListView1.ListItems(i).ListSubItems.Item.Text
!Upgrade = ListView1.ListItems(i).ListSubItems.Item.Text
.Update
End With
Next

__________________
Regards

Terry

Mini Soccer sets the standards
www.cbyfc.co.uk/hawks.html

Data From Listview Into Database?
Hi,
i am using dao to work with an access database.
on my form i have a listview which the user can input to, when they click a save button i want to place the contents of the listview into a table in the database.
Any tips on making this happen?
Here is my code so far, but i get an error when executing it (Argument not optional)

Code:For i = 1 To ListView1.ListItems.Count Step 1
With namesrs
.AddNew
!names_id = Nbooking_id + 1
!booking_id = Nbooking_id
!Name = ListView1.ListItems.Item.Text
!Ins_A = ListView1.ListItems(i).ListSubItems.Item.Text
!Ins_C = ListView1.ListItems(i).ListSubItems.Item.Text
!Ins_S = ListView1.ListItems(i).ListSubItems.Item.Text
!Ins_X = ListView1.ListItems(i).ListSubItems.Item.Text
!Coach = ListView1.ListItems(i).ListSubItems.Item.Text
!Air = ListView1.ListItems(i).ListSubItems.Item.Text
!Train = ListView1.ListItems(i).ListSubItems.Item.Text
!Other = ListView1.ListItems(i).ListSubItems.Item.Text
!Type = ListView1.ListItems(i).ListSubItems.Item.Text
!Room = ListView1.ListItems(i).ListSubItems.Item.Text
!Ski = ListView1.ListItems(i).ListSubItems.Item.Text
!Board = ListView1.ListItems(i).ListSubItems.Item.Text
!Boots = ListView1.ListItems(i).ListSubItems.Item.Text
!Pass = ListView1.ListItems(i).ListSubItems.Item.Text
!Upgrade = ListView1.ListItems(i).ListSubItems.Item.Text
.Update
End With
Next
Regards

Terry
 
Mini Soccer sets the standards
www.cbyfc.co.uk/hawks.html

Filling ListView With Data From A Database
I'm trying to fill a ListView control with data from one of my databases. I'm using Access 97 with an ADO connection, not DAO. I have tried but haven't figured out how to fill the ListView control with recordset data. I haven't ever really used a ListView control ever I usually use TrueDBGrid but that will not work in my current application I'm building. Anyway here is my code to hit and open/close the recordset:

Dim bSetNo1 as Byte
Dim gtSQLStmt as String

gtSQLStmt = "SELECT * FROM Table" & _
" WHERE index_num = '" & txtIndexNum & "'"

open_recordset_sub gtSQLStmt, bSetNo1

If adoRec(bSetNo1).RecordCount Then
'Code usally goes here
End If

close_recordset_sub bSetNo1

Can anyone help?

Save Listview Data To A DataBase
Hi Guys:

I have a ListView with 2 Colummn: "Description", "Price" and One bottom "Save"


How Can I save those Item from The listview when I click the Bottom
"cmdSave_Click"

I'll Appreciate if some one can help me,

Elvis Cabral

How To Save Listview Data To Database?
hello,please help how to save listview data to access database???

Code:Private Sub cmdsave_Click()
      Dim adoRecordset As ADODB.Recordset
     
      Dim conDataConnection As Connection
      Set conDataConnection = New Connection
      conDataConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & App.Path & _
                "Overtime.mdb;Persist Security Info=False"
   
      Set adoRecordset = New ADODB.Recordset
      adoRecordset.Open "SELECT * FROM Overtime", conDataConnection, adOpenStatic, adLockOptimistic
      
      With adoRecordset
      .AddNew
      .Fields("EmployeeName") = ListView1.ListItems.Add("Employee Name")
      .Update
  
      End With
      
      adoRecordset.Close
      'Close Connection
End Sub
 

thanks for help!

 

Can We Save Data From Listview To Database?
a



Edited by - say2x on 10/10/2005 11:40:31 PM

Save Listview Data To Access Database
hello,how to save the listview data to the database???


Code:
Private Sub cmdsave_Click()
Dim adoRecordset As ADODB.Recordset

Dim conDataConnection As Connection
Set conDataConnection = New Connection
conDataConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & App.Path & _
"Overtime.mdb;Persist Security Info=False"

Set adoRecordset = New ADODB.Recordset
adoRecordset.Open "SELECT * FROM Overtime", conDataConnection, adOpenStatic, adLockOptimistic

With adoRecordset
.AddNew
.Fields("EmployeeName") = ListView1.ListItems.Add("Employee Name")
.Update

End With

adoRecordset.Close

End Sub


Thanks for help!

*RESOLVED* Error Displaying Data From Database Onto Listview
Hey people. I am new to programming using ADODB, i know the basics but i have hit a problem that i cant really firgure it. It is to do with database entry and reading using MS Access. The program is meant to read from the database as it is and display the information within the database in a listview in the program in chronological order. However my problem is that after the 70th or so entry in the database, when the program reads it it does not display it in the correct chronological order as it should, it starts to put those that were meant to be at the end of the list view at the front.

I have attached the extracted code with this post. Your help would be much appreciated.




Edited by - lianp on 1/3/2005 5:43:06 PM

Export Data From ListView Into Access Database [ABANDONED]
Hello everyone,

what I would like to do is basically...I have a listview...it loads data from a database and puts it into the listview...the user is then able to modify various items in the listview...now I want to know how I can save all these updated items into access

So basically

- load data from Access into listview
- user modifies data in listview
- user click command button ("Update")
- program then saves all the data from the list view and puts them in the database

thank you..i hope that is clear


I would really appreciate any help or advice given..

thanks.

 lianp



Edited by - lianp on 11/10/2005 6:17:31 AM

In Listview I Would Like Use Database And All Data Show In List Columnheader Wise
in listview i would like use database and all data show in list columnheader wise ...?

Reading/Import Data From Excel 2003 File And Write/export To Access 2003 Database
I'm developing Database System using MS Access 2003
As the old data are all in Excel format, I'd like to add a function into the system so that operator import old data from Excel file into the Access 2003. But i do not know how to write data into Access Database using dataset object

I have write the follwing code to read data from Excel file:

Code: Public Sub import_from_excel()
Dim conn_excel As New OleDbConnection("Provider=Microsoft.Jet.Oledb.4.0;Data Source=c:
eport
eport_10102006.xls;Extended Properties=Excel 8.0")

sqlcommand = String.Empty
sqlcommand = "Select * from ['Multiple PN$']"
Dim excel_adaptor As New OleDbDataAdapter(sqlcommand, conn_excel)
Dim excel_DS As New DataSet
excel_adaptor.Fill(excel_DS)

'For testing
Dim excel_DT As New DataTable
Dim f_ed As New excel_data
f_ed.Show()
excel_adaptor.Fill(excel_DT)
f_ed.dg_excel.DataSource = excel_DT
'conn_excel.Open()
conn_excel.Close()
       
End Sub

Reading ADSI Database With VB && Store In SQL SERVER Database
This is first time I m looking for help in any VB forum I hope I can get some useful hint or help regarding my current problem. Let me describe in brief what we want:

We have one vb application which uses the MS-SQL Server Database. We want some changes in the login screen as per our new requirement.

What we want
1)We want to add one form which will show one button called ‘Update Users’ on clicking the button application will read the current users from the ADSI and store/update in the SQL-DATABASE(User Name and password in the existing table in our database).

2) When we will start the application system checks for the current windows user name and password if same user name and password exist in the MS-SQL Server database then there is no need to show login page but if the user name or password not in the database then prompt for the Login Screen

Please help me to find out how to read the ADSI Database using the VB Application email (bestloveh@yahoo.com)

Thanks

Reading Item On A Listview
This is my code:
Sub SaveListview1(oform As Form)
On Error GoTo Err_Handeler
Set RsTemp = New ADODB.Recordset
RsTemp.Open "Forma_Pago_suscripcion", cn, adOpenDynamic, adLockPessimistic
rc% = oform.ListView1.ListItems.Count
oform.ListView1.ListItems(oform.ListView1.SelectedItem.Index + 1).Selected = True

For i% = 1 To rc% - 1
With RsTemp
.AddNew
.Fields!id_suscripcion = oform.txtsuscripcion
.Fields!Forma_Cobro = oform.ListView1.SelectedItem.SubItems(3)
.Fields!Numero_Tarjeta_Credito = oform.ListView1.SelectedItem.SubItems(6)
.Fields!Codigo_Banco = oform.ListView1.SelectedItem.SubItems(8)
.Fields!Tipo_Tarjeta = oform.ListView1.SelectedItem.SubItems(5)
.Fields!No_Aprobacion = oform.ListView1.SelectedItem.SubItems(9)
'.Fields!Codigo_TipoCuenta = oForm.Listview1.SelectedItem.SubItems(1)
.Fields!Numero_Cuenta = oform.ListView1.SelectedItem.SubItems(7)
.Fields!Fecha_Vencimiento = oform.ListView1.SelectedItem.SubItems(10)
.Fields!Monto = oform.ListView1.SelectedItem.SubItems(11)
.Update
End With
oform.ListView1.ListItems(oform.ListView1.SelectedItem.Index + 1).Selected = True
Next

RsTemp.Close
Set RsTemp = Nothing
Exit Sub
Err_Handeler:
If Err <> 0 Then
MsgBox Err.Source & "-->" & Err.Description, , "Error En Sistema"
End If
End Sub

What i am trying to do is:
a) Read Data from a Listview from record one thru the end ( rc% = oform.ListView1.ListItems.Count)
b) In the loop i read from 1 to rc% = oform.ListView1.ListItems.Count - 1
c) i save the data on the listview to a table
d) i move to the next record on the listview

Error: Index out of bound. I can not find where the error is. Any idea?

Reading Item On A Listview
This is my code:
1. I inserted data into the listiview
2. As soon the user press SAVE I (i suppose) position the listview in the first item: ListView4.ListItems(ListView4.SelectedItem.Index + 0).Selected =
3. then i loop until the number of item and move to the next record
ListView4.ListItems(ListView4.SelectedItem.Index + i).Selected = True ' Avanzar


irecordcount = ListView4.ListItems.Count
ListView4.ListItems(ListView4.SelectedItem.Index + 0).Selected = True 'Posicionar en el registro 0
For i = 0 To irecordcount - 1
ListView4.ListItems(ListView4.SelectedItem.Index + i).Selected = True ' Avanzar
Call DetalleSuscripcionDireccion(txtsuscripcion, Me)
Next

Reading A File To A Listview How ?
Hi , Jason Here. I was wounder how would i go about reading a file to a listviwew with 2 colums ? like in the file there would be text like


"Someones Name1" "Someones Address1"
"Someones Name2" "Someones Address2"
"Someones Name3" "Someones Address3"
"Someones Name4" "Someones Address4"

i want

"someones name1" in coluim 1 of line 1 and
"someones address1" in colum 2 of line 1

then i want

"someones name2" in coluim 1 of line 2 and
"someones address2" in colum 2 of line 2

. How do i go about doing this . the file does not have to be like that as long as i can get the name and addreass in different colums.

Reading From File To Listview...
Public Sub ReadWebLog()
Dim intFNum As Integer
Dim strRData As String
Dim lstItem As ListItem
Dim tdDate As Date
Dim tdTime As Date
Dim strWebsite As String
Dim blnBlocked As Boolean

intFNum = FreeFile

Open (App.Path & "WebLog.dat") For Input As #intFNum

Do Until EOF(intFNum)

Input #intFNum, tdDate, tdTime, strWebsite, blnBlocked

Set lstitm = frmWebsiteLog.lstvWebLog.Add(, , tdDate)
lstitm.ListSubLists(1).Text = tdTime
lstitm.ListSubLists(2).Text = strWebsite
lstitm.ListSubLists(3).Text = blnBlocked
Loop


Close #intFNum
End Sub

This code does not read from a comma-delimited file. I want to read this data into a listview control. It tells me .Add is not a method or anything, I don't know how to add this data to a litview contro. Can anyone help?!

Reading Treeview And Listview
I have a third-party program with a treeview and a listview control. I don't know what program they used to create it. I want to write a program that can read the nodes in the treeview and the information in the the listview. Where do I start?

Thank you.

Reading Text From Other Application's ListView Control
Hi,

I need help reading text from other (not mine) application with a ListView control on one of it forms.

I can get the handle of the ListView but I'm having trouble reading it using the SendMessage WinAPI function (with the LVM_GETITEMTEXT parameter) because it needs a pointer to some structure as parameter and I can't ofcourse pass a pointer from one application to another because it's not in the same address space.

Can anyone think of a better way?

thanks!

Oren.

Listview; Getting Data (populate Listview) From 2 Tables??
hi!

im using a listview of my program..
where i need popluate the it with data coming from 2 tables, (table 1 and table 2); and where one of the entities in both table are the same...
for instance;
table 1 = stud_genInfo
table 2 = stuf_Offenses
both has the entity= stud_Number..
in which i need to show the stud number in my listview..

how can set (code) to show the Stud_no.?? confused:

can anyone help me with this one?? pls i need ur help, badly...

i would appreciate all the help/suggestions anyone would give..

mauve
-----
btw, this is a snip of my code:

strToday = Format (now, "mmddyyy")
With rsSearch
.Open "SELECT * FROM GenIndo, Offenses WHERE Schedule.Date_Today = '" & strToday & " ' And Schedule.Stud_No =CheckUp.Stud_No", CN, adOpenStatic, adLockPessimistic

If .RecordCount <= 0 Then
lvwSchedule.ListItems.Clear
Else

lvwSchedule.ListItems.Clear
.MoveFirst


Do Until .EOF


Set xlist_item = lvwSchedule.ListItems.Add(, , !Stud_NO) ' this is the line(part) where VB highlights the error

xlist_item.ListSubItems.Add , , (UCase(!Last_Name) & ", " & !First_Name & " " & !Middle_Name)
xlist_item.ListSubItems.Add , , (!Offense)
xlist_item.ListSubItems.Add , , (!Offense_Type)
xlist_item.ListSubItems.Add , , (!Offense_No)
.MoveNext

Loop
End If
.Close
End With

Set rsSearch = Nothing


-------

thank u so much...:

Reading A Text Record And Place Into Listview Control
Hi Friends
I have following Data received from Telecom Company.It's giving 24 different datas n a day.I want to list all the records

into List View.If anybody have a idea pls guide me

Records are Following....

IM ORIGINATING COMMAND # = 000996.3564
OP TRFTR TGCOMP PART 1 OF 12

DATE 03-03-05 ID START END
PROGRAM - - - -
PERIOD : :
INTERVAL 1 00:00 01:00
DATA IS VALID
ALL USAGE IN ERLANG TIMES 100
AVG 100-SECOND SCANS 36

ALL TRUNK GROUP DATA

TGN ISEIZE IROUTE ISETUP ISATTMP IANS ICONGES
100 22 22 0 0 9 0

TGN OATTMPT OVFL OSEIZE OARR OSATTMP OANS
100 11 0 12 0 7 6

TGN TOTUSG MTUSG IANSUSG OANSUSG BWINCU BWOUTU
100 55 0 5 38 8 47

TGN INSVC OOSMTCE OOS TRANBID ITRANSZ DBLSZR
100 35 0 0 0 0 0

TGN MATTMPT MOVFL MSEIZE FCO
100 0 0 0 5


M ORIGINATING COMMAND # = 000996.3564
OP TRFTR TGCOMP PART 2 OF 12

DATE 03-03-05 ID START END
PROGRAM - - - -
PERIOD : :
INTERVAL 1 00:00 01:00
DATA IS VALID
ALL USAGE IN ERLANG TIMES 100
AVG 100-SECOND SCANS 36

ALL TRUNK GROUP DATA

TGN ISEIZE IROUTE ISETUP ISATTMP IANS ICONGES
150 30 30 0 0 15 1

TGN OATTMPT OVFL OSEIZE OARR OSATTMP OANS
150 5 0 6 0 3 3

TGN TOTUSG MTUSG IANSUSG OANSUSG BWINCU BWOUTU
150 113 2 33 66 44 66

TGN INSVC OOSMTCE OOS TRANBID ITRANSZ DBLSZR
150 15 0 0 0 0 0

TGN MATTMPT MOVFL MSEIZE FCO
150 0 0 0 6

I want to read the following text item and placed into list of Columns as mentioned below..

Date Start End TGN ISEIZE IROUTE ISETUP ISATTMP IANS ICONGES OATTMPT OVFL OSEIZE OARR OSATTMP OANS

TOTUSG MTUSG IANSUSG OANSUSG BWINCU BWOUTU INSVC OOSMTCE OOS TRANBID ITRANSZ DBLSZR MATTMPT MOVFL MSEIZE FCO

Regard

P.S.Selvan

Reading Database
Hey guy I wanted to know how I could read the info like the password and username for a login for our program.

Reading A Database
give the code below why does label 8 +5 come up blank


While Not Data1.Recordset.EOF
If Data1.Recordset.Fields("Country Code").Value = Label3.Caption Then
Label8.Caption = Data1.Recordset.Fields("Country Name").Value
Label5.Caption = Data1.Recordset.Fields("National Anthem").Value
End If
Data1.Recordset.MoveNext
Wend

thanks

spider

Reading Of Database
Dear Beloved Friends.

I'm a kinda new in this VB programming, and most of my work is copy+paste :/

And yet again, im searching for help.

I've made a small simple program:
http://www.samberg.dk/listbox.rar

It's only function is to open Notebook and Paint, quete simple.

But i was wondering, if one of you guys could make me a program, quete the same, but the only differens would be:
Instead of reading the names and paths of the program, FROM the .EXE file (the project) it would be reading the paths and names from a database file,
like a .INI or excel file, or something 3rd, so i could change the programs, without using Visual Basic! Ö
Like: ID1 = Paint|C:WINDOWSSystem32MSPaint.exe - or something.

Is it possible, and could one of you beloved guys, make it for me and upload it?
To like, your hp, or megaupload, or stuff?

That would be SO appreciatet.

Best Regards
Frederik (Im from Denmark)

- P.S. Sorry for the bad english :/

Reading From A Database
I want to be able to read from a database and see if I have a customers information. How would I go about doing this? Here is the code I use to enter the information using a userform.
Code:
Private Sub cmdAdd_Click()


Dim iRow As Variant 'Declares arrays used for cell
Dim ws As Worksheet
Set ws = Worksheets("Random")
Dim ws2 As Worksheet
Set ws2 = Worksheets("Bartender File")
Dim iRow2 As Integer
iRow2 = 2



'find first empty row in database
iRow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row

'check for a part number


If Trim(Me.cboTitle.Value) = "" Then
Me.cboTitle.SetFocus
MsgBox "Please enter a Visitor Type", vbExclamation, "Customer Information"
Exit Sub
End If
If Trim(Me.txtFirstName.Value) = "" Then
Me.txtFirstName.SetFocus
MsgBox "Please enter a First Name", vbExclamation, "Customer Information"
Exit Sub
End If
If Trim(Me.txtLastName.Value) = "" Then
Me.txtLastName.SetFocus
MsgBox "Please enter a Last Name", vbExclamation, "Customer Information"
Exit Sub
End If
If Trim(Me.txtTitle.Value) = "" Then
Me.txtTitle.SetFocus
MsgBox "Please enter a Title", vbExclamation, "Customer Information"
Exit Sub
End If
If Trim(Me.txtCompany.Value) = "" Then
Me.txtCompany.SetFocus
MsgBox "Please enter a Company", vbExclamation, "Customer Information"
Exit Sub
End If
If Trim(Me.txtAddress.Value) = "" Then
Me.txtAddress.SetFocus
MsgBox "Please enter a Address", vbExclamation, "Customer Information"
Exit Sub
End If
If Trim(Me.txtCity.Value) = "" Then
Me.txtCity.SetFocus
MsgBox "Please enter a City", vbExclamation, "Customer Information"
Exit Sub
End If
If Trim(Me.cboState.Value) = "" Then
Me.cboState.SetFocus
MsgBox "Please enter a State", vbExclamation, "Customer Information"
Exit Sub
End If
If Trim(Me.txtZipCode.Value) = "" Then
Me.txtZipCode.SetFocus
MsgBox "Please enter a ZipCode", vbExclamation, "Customer Information"
Exit Sub
End If
If Trim(Me.txtPhone.Value) = "" Then
Me.txtPhone.SetFocus
MsgBox "Please enter a Phone #", vbExclamation, "Customer Information"
Exit Sub
End If
If Trim(Me.txtFax.Value) = "" Then
Me.txtFax.SetFocus
MsgBox "Please enter a Fax #", vbExclamation, "Customer Information"
Exit Sub
End If
If Trim(Me.txtEmail.Value) = "" Then
Me.txtEmail.SetFocus
MsgBox "Please enter a Email Address", vbExclamation, "Customer Information"
Exit Sub
End If
If Trim(Me.txtCell.Value) = "" Then
Me.txtCell.SetFocus
MsgBox "Please enter a Cell #", vbExclamation, "Customer Information"
Exit Sub
End If
If Trim(Me.txtKTCContact.Value) = "" Then
Me.txtKTCContact.SetFocus
MsgBox "Please enter a KTC Contact", vbExclamation, "Customer Information"
Exit Sub
End If
Unload Me

'copy the data to the database
ws.Cells(iRow, 1).Value = Me.cboTitle.Value
ws.Cells(iRow, 2).Value = Me.txtFirstName.Value
ws.Cells(iRow, 3).Value = Me.txtLastName.Value
ws.Cells(iRow, 4).Value = Me.txtTitle.Value
ws.Cells(iRow, 5).Value = Me.txtCompany.Value
ws.Cells(iRow, 6).Value = Me.txtAddress.Value
ws.Cells(iRow, 7).Value = Me.txtCity.Value
ws.Cells(iRow, 8).Value = Me.cboState.Value
ws.Cells(iRow, 9).Value = Me.txtZipCode.Value
ws.Cells(iRow, 10).Value = Me.txtPhone.Value
ws.Cells(iRow, 11).Value = Me.txtFax.Value
ws.Cells(iRow, 12).Value = Me.txtEmail.Value
ws.Cells(iRow, 13).Value = Me.txtCell.Value
ws.Cells(iRow, 14).Value = Me.txtKTCContact.Value

'going to Bartender File
ws2.Cells(iRow2, 1).Value = Me.txtFirstName.Value
ws2.Cells(iRow2, 2).Value = Me.txtLastName.Value
ws2.Cells(iRow2, 3).Value = Me.txtTitle.Value



'clear the data
Me.cboTitle.Value = ""
Me.txtFirstName.Value = ""
Me.txtLastName.Value = ""
Me.txtTitle.Value = ""
Me.txtCompany.Value = ""
Me.txtAddress.Value = ""
Me.txtCity.Value = ""
Me.cboState.Value = ""
Me.txtZipCode.Value = ""
Me.txtPhone.Value = ""
Me.txtFax.Value = ""
Me.txtEmail.Value = ""
Me.txtCell.Value = ""
Me.txtKTCContact.Value = ""

Thankyou.Show


End Sub

Reading From Database
I got this so far:

VB Code:
Set DB = OpenDatabase(App.Path & "Stilo.mdb")  'Open the Contact table  Set RS = DB.OpenRecordset("SELECT * FROM Contact WHERE # = '" & 5 & "'") What do i do next?How do i read the value to a textbox?

Reading From A Database On The Web
I found out that my program is 16 megs big. Therefore, what I would like to do is place my database on the web. However, I'm not sure how to tell my vb program to read from my site. Can anyone help me?
Dan jamaica125@msn.com

Reading From A Database
How would I read information from a database? any and all help would be greatly appreciated.




- Zer0 -
The first law of computer programming: The user is a complete idiot.

Edited by - Zer0 on 12/8/2002 7:59:00 PM

Reading .pdb Database
Helo everyone, i have a problem on how to read .pdb database. My plan is to create a dll that create an odbc connection to read and edit any kind of database...

any help is deeply appreaciated.

Thanks!!!!

Reading From Database
Hi All,

could some one please let me know how to open database(Access) and check for login name and password from the user table at runtime. I want to check for all the available users in the table.

Thanks and regards
Ram

Reading From A Database
ok i need to read from a database i have and then open outlook express and send an email to each of the people in the database depending on what the email address is in the database but i need this to happen when i push a button the stop when i push another one then if i push the button to start it i need to continue where it left of at plz help me ive tried a couple of things and they dont work

ActiveX Reading Database???
Can an ActiveX Control on a webpage make a connection to a SQL Database?

Thanks for any input...

Database Reading/displaying
Well i have another question for ya. I need to read my SKU, description, unit price and quanity-in-stock from the invemtory table in the database.

I need to be able to have an error when someone puts in a wrong SKU, same as if they put in letters for the quanity.

I will need it to display the description and unit price in a text box after it finds it on the database (after entering the SKU & unit price)

Thanks for your time,
David

Only Reading One Record From Database
Hi,

i have written some code to connect to an access database using the jet engine.

The purpose of it is to read a table called "Accounts" and check the username and password which is put in the program with the username and password fields in the database.

I thought i had it sorted but i only had one record in the DB. when i put another record in the DB and try and login to the program. it only accepts the last records data in the table.

e.g.

Account ID | Type | Username | Password
-----------------------------------------
0001 |admin | sam | sam
-----------------------------------------
0002 | admin | jack | jack
-----------------------------------------


the program will only accept jack, jack as the username and password..

here is the code i have ::


Code:
Sub LoginCheck()

Dim MyConn As ADODB.Connection 'VARIABLE FOR CONNECTION
Dim MyRecSet As ADODB.Recordset 'VARIABLE FOR RECORDSET

Set MyConn = New ADODB.Connection 'GIVE CONNECTION VAR DATA
MyConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:SAMS FOLDER 2collegeDatabase projectgood.mdb;" 'TOOLS NEEDED FOR RETRIEVEMENT OF DATA FROM DATABASE
MyConn.Open 'OPEN DATABASE

Set MyRecSet = MyConn.Execute("SELECT [Type], [Username], [Password] FROM Accounts") 'GET INFO FROM SPECIFIC FIELDS


Do Until MyRecSet.EOF
strName = MyRecSet.Fields.Item("Username").Value 'GIVING strName DATA
strPassword = MyRecSet.Fields.Item("Password").Value 'GIVING strPassword DATA
strType = MyRecSet.Fields.Item("Type").Value

varDbType = strType
varDbPassword = strPassword 'TRANSFERING VARIABLE TO A GLOBAL VARIABLE
varDbUsername = strName 'TRANSFERING VARIABLE TO A GLOBAL VARIABLE
MyRecSet.MoveNext
Loop

MyConn.Close 'CLOSE DATABASE


End Sub
any ideas?

Writing To A Database While Reading From It.
Hi All,
I am reading from a database in order to display its contents using the following code.



VB Code:
Private Sub DisplayEventGrid(LogNumber As Integer)     'Populate the event log grid     Dim i As Long    Dim j As Long    Dim DisplayLog As Database                   'Data base for display purposes    Dim RequiredTable As TableDef                'Reference to required table in a database.    Dim EventFieldRecord As Recordset            'Reference to required event data entry within a field.     On Error GoTo LogLoad_Err        Set DisplayLog = OpenDatabase("Mydatabase.mdb")     'Open the required event data base     'Get event data    Set RequiredTable = DisplayLog.TableDefs("Events")    Set EventFieldRecord = DisplayLog.OpenRecordset("Events")        i = 1    If Not EventFieldRecord.EOF Then        Do While Not EventFieldRecord.EOF            If (bShowTodayOnly = True And EventFieldRecord.Fields(0).Value = Date) Or bShowTodayOnly = False Then                flxEvents.Rows = flxEvents.Rows + 1                For j = 0 To EventFieldRecord.Fields.Count - 1                    If Not IsNull(EventFieldRecord.Fields(j).Value) Then                        If j = 0 Then       'Date                            flxEvents.TextMatrix(i, j) = Format(EventFieldRecord.Fields(j).Value, "dd/mm/yy")                        ElseIf j = 1 Then   'Time                            flxEvents.TextMatrix(i, j) = Format(EventFieldRecord.Fields(j).Value, "hh:mm:ss")                        Else                            flxEvents.TextMatrix(i, j) = EventFieldRecord.Fields(j).Value                        End If                    End If                Next                flxEvents.TextMatrix(i, j) = Mid$(flxEvents.TextMatrix(i, 0), 7, 2) + Mid$(flxEvents.TextMatrix(i, 0), 4, 2) + Mid$(flxEvents.TextMatrix(i, 0), 1, 2) _                + Mid$(flxEvents.TextMatrix(i, 1), 1, 2) + Mid$(flxEvents.TextMatrix(i, 1), 4, 2) + Mid$(flxEvents.TextMatrix(i, 1), 7, 2)                i = i + 1            End If            EventFieldRecord.MoveNext            DoEvents        Loop    End If            EventFieldRecord.Close    DisplayLog.Close Exit Sub  LogLoad_Err:    'Error handling    If Err = 3343 Then      'Corrupted database.        Do While MessageBox(MDIFrmMain.hwnd, _            "Unable to display corrupted log.", _            "Corrupted Database Found", vbExclamation + vbOKOnly) = False            DoEvents        Loop    Else        DoEvents        Resume Next    End If    End Sub


The problem I have is that the database may be written to while I am reading from it.
This causes an error 3420 which gets trapped but unfortunately the database read does not then complete.

Any help would be appreciated.

Reading From File Vs Database
Hi guys!

This is my first post so go easy on me. :-)

I am currently thinking of developing an insurance agency management system. I work for an agency and see a need that isn't being filled by the typical solutions out there.

Typically, they require SQL Server as that is the primary database holding the data. I would like to not have a requirement to use SQL Server, as it is expensive and the users would have to purchase licenses, have a big enough server, etc...

Now here's the question, and I hope I don't sound crazy. Couldn't I just basically set up my own proprietary database, which would consist of a file (or multiple files) that gets(or get) read from?

I assume SQL is faster, but why? It could likely keep some recently accessed things in memory, but typically it reads from the hard drive as well, right? Obviously the whole thing can't be held in memory (which is faster than HD access). Maybe it is written in optimized code, and it's obviously written in C/C++, but that can't be THAT much of a speed difference.

All of the programs I have written in the past use custom text files on the HD. They all worked fine.

Other than the fact that I can't use handy SQL statements to querry the database (and must use some recursive search functions), what are any other reasons why I shouldn't just have my program read from / write to a file(or files) on the hard drive as opposed to a database like SQL?

Thanks for any help on this!

Reading Database Error !! Why?
Private Sub cmdSave_Click()
Dim TableName As String
Dim myDB As DAO.Database
Dim td As DAO.TableDef
Dim f As DAO.Field

On Error GoTo errhandler

Set myDB = DAO.OpenDatabase("C:infodb.mdb")
Set td = myDB.CreateTableDef(TableName)

'add the fields

Set f = td.CreateField("SNO", dbLong)

td.Fields.Append f

myDB.TableDefs.Append td

myDB.Close
...

it stops running - it doesn t read the database file why???
Its in access 2000 format.

ActiveX Reading Database???
Can an ActiveX Control on a webpage make a connection to a SQL Database?

Thanks for any input...

Problems With Reading From A Database
everytime i run this code it crashes at "RS.allocated" ive check all spelling etc and this is how i usally read from a database and it works... i have recently upgraded VB6 to SP4 cud this be the problem



Code:
Private Sub Command2_Click()
Dim DB As Database
Dim RS As Recordset

Set DB = DAO.OpenDatabase("
erovbdata$holiday.mdb")
Set RS = DB.OpenRecordset("employee")

MsgBox RS.allocated

End Sub


Generates Error:

"Complie Error:
Method or data member not found"

thanks in advance
Chenko

Error Reading A Database From Cd
We are making an application that will read data from the cd .We're having a problem reading a ms access database from the cd. It keeps on displaying that the database has been exclusively opened by another user.
What seems to be the possible cause of this?

Reading From One Database And Writing To Another
Hi,
I have task of extracting data from one SQL database and using this data to update a second database after doing some work on the data to make it fit in to the second database, I am thinking of using VB.net, but I am not sure if I can open 2 databases in the same time and read from one and write to the other, and the best way to do it, as you see any help is appreciated

Vb6 Reading Paradox 7 Database
Hi all,
I have been having problems opening Paradox 7 tables using DAO. I am now told DAO is not capable of this.

What is the best way to open/read/write Paradox 7 tables, many of which have names of 10 or so characters long.

I have been reading the tables by linking them through Access but would much prefer to read the tables direct.

Any pointers will be very much appreciated

Regards
Bigfella

Problem On Reading Database
dear all

    i am doing a stock tracking program and in the form, i have a addnew, stock in and stock out button. when user click on the stock in or stock out button, it will prompt out with a input box for the user to enter the value and all the transaction will automatically be updated in the database....
    now the problem is the after the updating is done, when i click on the navigation button, it prompt out with this error message : Row cannot be located for updating. Some values may have been changen since it was last read.
    i am using Data Environment designer for this program......
    any idea on how to solve this problem???
    thanx in advanced!!!

Copyright © 2005-08 www.BigResource.com, All rights reserved