Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi to all,
Need help with Visual Basic 6.
I am less than a “NEWBIE” (as I am 77 and to old to learn programming) trying to make a very small VB6 executable inventory program out of a current Access 2.0 program.
Form has 13 txt.Boxes (1 thru 13 records), one dialog box (Data1 record box) along with 7 cmdButton_Click () named Add, Undo, Last, Edit, Save, Delete and Find (records) and 3 cmdButtons_Click () named Preview, Print and Export (report).
If you can help and there is a charge, please advise me via e-mail to “vb6@dslextreme.com”
Here is what I have:
=================================================================================
Option Explicit
‘this works OK
Private Sub cmdExport_Click()
DataReport1.ExportReport rptKeyHTML, "C:\ClayPENEtration\ClayReport\ClayReport.htm", True, True, rptRangeAllPages
End Sub‘this works in Integer, but how do I find a string (like mel) ?
Private Sub cmdFind_Click()
Dim Record As Integer
Record = InputBox("Enter the Record # or Data String to Find", "Find Record")
Data2.Recordset.Index = "Record"
Data2.Recordset.Seek "=", Record
End Sub‘this works
Private Sub cmdLast_Click()
Data2.Recordset.MoveLast
End Sub‘this works, but does not show updated info.
Private Sub cmdPreview_Click()
DataReport1.Show
End Sub‘this works, but does not print current updated report
Private Sub cmdPrintReport_Click()
DataReport1.PrintReport True
End Sub‘this works OK
Private Sub cmdUndo_Click()
Data2.Recordset.CancelUpdate
End Sub‘this works but does not update to report
Private Sub cmdAdd_Click()
Data2.Recordset.AddNew
End Sub‘this works OK
Private Sub cmdDelete_Click()
'this may produce an error if you delete the last
'record or the only record in the recordset
Data2.Recordset.Delete
Data2.Recordset.MoveLast
End Sub
‘this works OK
Private Sub cmdQuit_Click()
Unload Me
End Sub‘Don’t have a clue if the nest 3 are needed !
Private Sub Data2_Error(DataErr As Integer, Response As Integer)
'This is where you would put error handling code
'If you want to ignore errors, comment out the next line
'If you want to trap them, add code here to handle them
MsgBox "Data error event hit err:" & Error$(DataErr)
Response = 0 'throw away the error
End SubPrivate Sub Data2_Reposition()
Screen.MousePointer = vbDefault
On Error Resume Next
'This will display the current record position
'for dynasets and snapshots
Data2.Caption = "Record: " & (Data2.Recordset.AbsolutePosition + 1)
'for the table object you must set the index property when
'the recordset gets created and use the following line
'Data1.Caption = "Record: " & (Data1.Recordset.RecordCount * (Data1.Recordset.PercentPosition * 0.01)) + 1
End SubPrivate Sub Data2_Validate(Action As Integer, Save As Integer)
'This is where you put validation code
'This event gets called when the following actions occur
Select Case Action
Case vbDataActionMoveFirst
Case vbDataActionMovePrevious
Case vbDataActionMoveNext
Case vbDataActionMoveLast
Case vbDataActionAddNew
Case vbDataActionUpdate
Case vbDataActionDelete
Case vbDataActionFind
Case vbDataActionBookmark
Case vbDataActionClose
End Select
Screen.MousePointer = vbArrow
End Sub‘I think this is OK, but not sure if I have ADODB ?
Private Sub Form_Load()
Dim Conn
Set Conn = CreateObject("ADODB.Connection")
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\Claypenetration\Clay.mdb"
End Sub‘this works OK
Private Sub oleItemPhoto_DblClick(Index As Integer)
'this is the way to get data into an empty ole control
'and have it saved back to the table
oleItemPhoto(Index).InsertObjDlg
End Sub

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |