Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB 6
Password Reminder
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Pro VB 6 For advanced Visual Basic coders working in version 6 (not .NET). Beginning-level questions will be redirected to other forums, including Beginning VB 6.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Display Modes
  #1 (permalink)  
Old December 28th, 2007, 01:37 AM
Authorized User
Join Date: Jul 2006
Location: dera ismail khan, nwfp, Pakistan.
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to naveed77 Send a message via Yahoo to naveed77
Default data save problem from flex grid

dear friends.

i m new in vb6 i have been assigned tasks of making small database for entering record of employee in da following format in flexgrid.

[u]S.No City Name from date to date total service</u>

1. lahore 12/2/1990 11/1/1995
2. dikhan 12/1/1995 15/9/2005
3. karachi 16/9/2005 24/11/2006
4. dikhan 25/11/2006 --------

the above data is only for one employee and i want to save date like dis, in data base using flexgrid but wats exact coding plz, help me out, to solve da problem,
below is da code for saving records but i dont know wat is da code for saving above data

Dim db As New ADODB.Connection
Dim tb As New ADODB.Recordset
Dim recset As New Recordset

Private Sub cmdadd_Click()

If cmdadd.Caption = "&Add New" Then
cmdadd.Caption = "&Save"
'cmddelete.Caption = "&Cancel"
recset.Open "Select max(srno) as c from emp_personal", db

txtsrno = recset!c + 1


tb("SrNo") = txtsrno.Text
tb("Employee_Name") = txtename.Text
tb("Father_Name") = txtfname.Text
tb("nic") = masknic.Text
tb("brname") = cmbbrname.Text
tb("dob") = dtpdob.Value
tb("religion") = txtreligion.Text
tb("idmark") = txtmark.Text
tb("paddress") = txtaddress.Text
tb("photo") = txtphoto.Text
tb("appletter") = txtapletter.Text
tb("appdate") = dtpltrdate.Value

MsgBox "Record Successfully Entered", vbInformation, "Cantt Board Office, D.I.Khan"

cmdadd.Caption = "&Add New"
End If


End Sub

Private Sub Form_Load()

   Set db = New ADODB.Connection
    Set tb = New ADODB.Recordset

With db 'database connectivity with access
        .Provider = "microsoft.jet.oledb.4.0"
' .CursorLocation = adUseClient
        .Open App.Path & "\SBook.mdb"

    End With

    Dim sSQL As String
    sSQL = "select * " & _
          " from emp_personal"

                                              ' Open the tb table.
    With tb

      .CursorType = adOpenDynamic
      .LockType = adLockOptimistic
      .Open sSQL, db

    End With
 dtpdisp.Enabled = False
 txtdetail.Enabled = False
 txtresult.Enabled = False

Call headings
End Sub

Private Sub headings()

With grid
    .Col = 0
    .ColWidth(0) = 500
    .ColWidth(1) = 3500
    .ColWidth(2) = 1450
    .ColWidth(3) = 1400
    .ColWidth(4) = 1700

    .Row = 0
    .TextMatrix(.Row, 0) = "S.No"
    .TextMatrix(.Row, 1) = "Station Name"
    .TextMatrix(.Row, 2) = "From Date"
    .TextMatrix(.Row, 3) = "To Date"
    .TextMatrix(.Row, 4) = "Total Period Served"

End With

End Sub

Private Sub grid_KeyPress(KeyAscii As Integer)

    txtenter.Text = txtenter.Text & Chr(KeyAscii)
    txtenter.SelStart = 1

    txtenter.Move grid.CellLeft + grid.Left, grid.CellTop + grid.Top, grid.CellWidth, grid.CellHeight
    txtenter.Visible = True

End Sub

Private Sub grid_LeaveCell()
If txtenter.Visible = False Then
        Exit Sub
    End If
    grid.Text = txtenter
    txtenter.Visible = False
    txtenter.Text = ""
End Sub

thanq in advance
Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
save and update data problems using flex grid naveed77 Beginning VB 6 0 December 6th, 2007 02:57 AM
VS Flex Grid Version 7 abdulqadirpk VB Components 0 December 27th, 2006 06:16 AM
flex grid ullasmathew007@yahoo.com General .NET 0 January 12th, 2006 12:18 AM
Flex grid in VBA - Excel raj_phoenix Excel VBA 7 February 1st, 2005 06:40 AM
flex grid entry jady VB Databases Basics 1 September 29th, 2004 11:07 AM

All times are GMT -4. The time now is 11:33 PM.

Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.