One more try ... 
Author Message
 One more try ...

Deleted this twice, due to wrapping / messing-up . . .

Thanks to all who have e-mailed suggestions about my Grid-Grief.
The following "cheat" eliminated my grief over trying to "Point"
the RecordSelector (TrueDBGrid) at the newly added row/record :

(Writing something into the 1st cell of the new row...!)
-----------------------------------------------------------------------
Private Sub cmdAdd_Click()     'This adds a row, and automatically
Dim Z                          'assigns Job# to the JobID field .
Dim DB As Database, RS As Recordset
On Error Resume Next
    Set DB = OpenDatabase("C:\CostTrak\CostTrak.mdb")
    Set RS = DB.OpenRecordset("Mobe")
    DB.OpenRecordset ("Mobe")
    RS.AddNew
    RS.Fields("JobID") = EditJobNum$
    RS.Update
    datPrimaryRS.Refresh
    grdDataGrid.Refresh        ' Now, find out ...
    Z = grdDataGrid.VisibleRows          ' How Many rows ??
    grdDataGrid.Col = 1        ' Cell 'Location' now;
    grdDataGrid.Row = Z - 2              ' (ignore fixed...)
    grdDataGrid.EditActive = True           ' "Focus"
    grdDataGrid.Text = "[Enter] or [Delete]"    ' "OK"-Text won't save
End Sub                          ' to this field (Currency)!
-----------------------------------------------------------------------
Now, my tutorial (Help) explains to the <"computer-illiterate"> users
that after they  [Add]  a  Row/Record , and see this message . . .
"[Enter] or [Delete]" . . . it means that they are to either
begin entering data at "This Point", or click on the [Delete] command
button !
Of course, the "default" code for the {VB-Data-Aware-Form-Grid}
[Delete] command button left a bit to be desired ( not prompting the
user for verification before deleting ) . . . to wit , one should add :
-----------------------------------------------------------------------
Private Sub cmdDelete_Click()
Dim X
On Error Resume Next  ' in case of .Delete "difficulty". . .
    X = MsgBox("Are you sure you want to Delete this record ?", 1)
        If X = 2 Then
            Exit Sub
        ElseIf X = 1 Then
            With datPrimaryRS.Recordset
                .Delete
                .MoveNext
                If .EOF Then .MoveLast
            End With
        End If
End Sub
----------------------------------------------------------------------



Tue, 06 Jun 2000 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. One last try....

2. Does any one ever try *.res (Resource File)

3. one more try

4. One more try: InfoZip

5. one more try

6. A different one to try!

7. one more try

8. XML HTTP question...one more try

9. one more try

10. One more try - Accessing Parallel port on a network

11. One last try to get the correct attached file

12. How to group on records but . . .(one last try)

 

 
Powered by phpBB® Forum Software