Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 30th, 2003, 11:40 PM
Registered User
 
Join Date: Dec 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Datagrid Frustrations

OK, here is what I have. I populate a datagrid on form load with the following code:

Sub FillWeightArc()

Set connW = New adodb.Connection

connW.CursorLocation = adUseClient
connW.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & App.Path & "\sld32.mdb;" & ";" & "Jet OLEDB:Database Password=ice" _



Set rsW = New adodb.Recordset
rsW.Open "SELECT [WeighIn Date], Height, Weight,[Authorized Weight],[Body Fat %], [Authorized Body Fat %] from Weight WHERE SSN = " & """" & txtSSN.Text & """", connW, _
adOpenStatic, adLockOptimistic

rsW.Sort = "[WeighIn Date] desc"


With DataGrid2

.Caption = "Weigh In History"


Set .DataSource = rsW

.Columns(0).Width = 1000
.Columns(1).Width = 650
.Columns(2).Width = 650
.Columns(3).Width = 1400
.Columns(4).Width = 900
.Columns(5).Width = 1710

.Columns(0).Alignment = dbgCenter
.Columns(1).Alignment = dbgCenter
.Columns(2).Alignment = dbgCenter
.Columns(3).Alignment = dbgCenter
.Columns(4).Alignment = dbgCenter
.Columns(5).Alignment = dbgCenter

.Columns(0).NumberFormat = "DD MMM YY"
End With


End Sub

I have another form I use to add data to the DB table and use the following code to add the data to the DB:

rs13.AddNew
rs13.Update 'create and save new (empty) record
rs13.Bookmark = rs13.LastModified 'move to new record

'rs4.MoveLast
rs13.Edit

rs13![WeighIn Date] = frmWeightEntry.Text1.Text
rs13!Height = frmWeightEntry.Text2.Text
rs13!Weight = frmWeightEntry.Text3.Text
rs13![Authorized Weight] = frmWeightEntry.Text4.Text
rs13![Authorized Body Fat %] = frmWeightEntry.Text5.Text
rs13![Body Fat %] = frmWeightEntry.Text6.Text
rs13!SSN = frmMain.txtSSN.Text

rs13.Update

frmMain.FillWeightArc

Unload Me
Unload frmWeightEntry

The data loads fine on program start up. The form I use to add data to the DB works fine. Now the problem I have is updating the datagrid AFTER I have added new data. It does not immediately display the data in the datagrid, I have to move off the record and back again for the new data to appear in the datagrid.

Please, Oh please someone help me out here. I have been experimenting with this for at least 6 months and each time get frustrated with it and just quit. I have tried the rebind, refresh, etc anything I can think of. I am up for any solutions here, if I have to change my layout then so be it, I just need to be able to get this working.

Thanks,

Robert






Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom paging in Datagrid with datagrid page count madhusrp ASP.NET 1.0 and 1.1 Professional 12 June 2nd, 2008 01:15 PM
User COntrol Datagrid inside datagrid rodmcleay ASP.NET 1.0 and 1.1 Professional 3 April 14th, 2007 10:11 AM
output frustrations, please help! mellan XSLT 1 August 22nd, 2005 11:10 AM
Frustrations of Split(long) enterbase Access VBA 6 January 27th, 2004 04:19 PM
Frustrations with setting up site in VS.NET!!! buzzterrier BOOK: ASP.NET Website Programming Problem-Design-Solution 5 January 20th, 2004 02:02 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.