Symbianize Forum

Most of our features and services are available only to members, so we encourage you to login or register a new account. Registration is free, fast and simple. You only need to provide a valid email. Being a member you'll gain access to all member forums and features, post a message to ask question or provide answer, and share or find resources related to mobile phones, tablets, computers, game consoles, and multimedia.

All that and more, so what are you waiting for, click the register button and join us now! Ito ang website na ginawa ng pinoy para sa pinoy!

[TUT] VB6 MSAccess Sample using ADO (UPDATED V3 20100216) now with ADD and DataReport

Re: [TUT] VB6 MSAccess Sample using ADO (UPDATED V3 20100216) now with ADD and DataRe

cge., salamat otor., try ko muna.. feedback later
 
Re: [TUT] VB6 MSAccess Sample using ADO (UPDATED V3 20100216) now with ADD and DataRe

saan ba otor sa components un., ung MSHflexgrid
 
Re: [TUT] VB6 MSAccess Sample using ADO (UPDATED V3 20100216) now with ADD and DataRe

otor., wala ka yatang code para sa delete.... bigyan mo naman ako ng maikli lang .. ung selected ang madidilit..
 
Re: [TUT] VB6 MSAccess Sample using ADO (UPDATED V3 20100216) now with ADD and DataRe

otor., wala ka yatang code para sa delete.... bigyan mo naman ako ng maikli lang .. ung selected ang madidilit..

referring to version3:

oo di ko nilagay as a challenge sa inyo

mag run ka lang ng query na
DELETE FROM ProductsMaster WHERE ProductCode = 'xxx'
xxx a yung product code ng item

makukuha mo yan sa TAG ng selected na item sa listview

tignan mo yung Function na "Private Sub cmdSelect_Click()
" sa frmProductList kung papano nakukuha ang tag sa listview

if you have the query, use the code similar to
the function "Private Function UpdateProduct(sProductCode As String) As Boolean" found in "frmProductDetail"

sanayin nyo gumawa ng query at ipasa yan sa database using adodb.recordset, or adodb.command,

SELECT
INSERT
UPDATE
DELETE

yan lang naman mga basic na SQL,
after that mga advanced na to manipulate, compute or alter your database.
kung kabisado nyo na yan maski anong database ang iharap sa inyo madali na.

sa mga gumagamit ng ADODC parin its your choice na magpaiwan.
 
Re: [TUT] VB6 MSAccess Sample using ADO (UPDATED V3 20100216) now with ADD and DataRe

saan ba otor sa components un., ung MSHflexgrid

mag add ka sa toolbox ng vb6


rt click, components.... browse....

attachment.php
 

Attachments

  • Capture.PNG
    Capture.PNG
    49.8 KB · Views: 54
Re: [TUT] VB6 MSAccess Sample using ADO (UPDATED V3 20100216) now with ADD and DataRe

thanks otor..., nagawa ko na ung delete... ausin ko muna tong interface ko... ,saka ko na gawin ung sa flexgrid.. ganda ng interface ko .. dun na nga lang ako bumabawi eh.. hehehhe..
 
Re: [TUT] VB6 MSAccess Sample using ADO (UPDATED V3 20100216) now with ADD and DataRe

otor.. pahelp po, pano ko iviview sa listview ung mga files ng given folder, all filename po sa given path na folder..
 
Re: [TUT] VB6 MSAccess Sample using ADO (UPDATED V3 20100216) now with ADD and DataRe

otor.. pahelp po, pano ko iviview sa listview ung mga files ng given folder, all filename po sa given path na folder..

bakit pa e meron naman DirectoryListBox at FileListbox

or kung gusto mo talaga then get ready to code
ito medyo malinaw ang pag kaka code
http://www.freevbcode.com/ShowCode.asp?ID=4015

additional referrence
http://btmtz.mvps.org/listview/
http://btmtz.mvps.org/listview/vbdirectorylv.zip
http://www.codeproject.com/KB/cpp/ExpCombo.aspx
http://www.xtremevbtalk.com/showthread.php?t=137639
http://www.vbknowledgebase.com/?Id=20&Desc=List-Folders-And-Files

so makikita mo dyan gumagamit sila ng FileSystemObject

ito sa classic recursion naman ang code
http://www.developerfusion.com/article/38/advanced-files-folders/5/

try to experiment sa code para maintindihan mo ang inner logic nya
 
Re: [TUT] VB6 MSAccess Sample using ADO (UPDATED V3 20100216) now with ADD and DataRe

thanks otor., ano ung directorylistbox o filelistbox
 
Re: [TUT] VB6 MSAccess Sample using ADO (UPDATED V3 20100216) now with ADD and DataRe

thanks otor., ano ung directorylistbox o filelistbox

the name describes the functionality

tignan mo sa toolbox mo ang try to use it.
 
Re: [TUT] VB6 MSAccess Sample using ADO (UPDATED V3 20100216) now with ADD and DataRe

cge try ko muna..
 
Re: [TUT] VB6 MSAccess Sample using ADO (UPDATED V3 20100216) now with ADD and DataRe

otor my lalam ka ba na easiest way para iopen ang file gamit ang path ng file..?
 
Re: [TUT] VB6 MSAccess Sample using ADO (UPDATED V3 20100216) now with ADD and DataRe

otor my lalam ka ba na easiest way para iopen ang file gamit ang path ng file..?

ano pa bang easiest ang hanap mo?
sa vb.net isang line lang

pero sa vb6 meron tayong steps at methods na dapat sundin
mahirap ang buhay pag mag attempt kang maghanap pa ng shortcut kasi direct naman na yung commands e

--read text from file, display sa textbox

Dim F as Long
F= FreeFile
Dim variable1 As String
Open "c:\My Documents\sample.txt" For Input As #F
Input #F, variable1
Text1.Text = variable1
Close #F
End Sub

--write text to file from textbox

Dim F as Long
F= FreeFile
Dim StudentName As String
Open "c:\My Documents\sample.txt" For Output As #F
StudentName = Text1.text
Print #F, StudentName
Close #F

try mo imodify yung code sa paraan na mas madali sayo
or gawa ka ng function mo na shorcut na,
for example:
WriteToFile "text text", FileName
compile mo as DLL then yun ang gamitin mo sa pang araw araw
 
Re: [TUT] VB6 MSAccess Sample using ADO (UPDATED V3 20100216) now with ADD and DataRe

ok na po.. eto ginamit ko..

Code:
Private Declare Function GetDesktopWindow Lib "user32" () As Long
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" ( _
ByVal hwnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long

Private Const SW_HIDE As Long = 0
Private Const SW_NORMAL As Long = 1
Private Const SW_MAXIMIZE As Long = 3
Private Const SW_MINIMIZE As Long = 6



'// ShellExecute API.
'// Use Windows file associations to provide the easiest way to
'// process operations > Open, Print,Play or Explore
'// by passing just the FullPathFilename of the item.

Public Function ShellOper(strFileExe As String, _
Optional strOperation As String, _
Optional nShowCmd As Double) As Long

Dim hWndDesk As Long

hWndDesk = GetDesktopWindow()
If Len(strOperation) = 0 Then strOperation = "Open"
If Len(Dir(strFileExe)) = 0 Then
Shell "Explorer.exe /n,/e," & strFileExe, vbNormalFocus
End If

'// Failure >> <=32
ShellOper = ShellExecute(hWndDesk, strOperation, strFileExe, 0, 0, nShowCmd)
If ShellOper <= 32 Then
myMsgBox "Couldn't " & strOperation & " " & strFileExe
End If

Exit Function
ErrH:
ShellOper = -1
End Function

Private Sub imgOpenFiles_Click()
Dim ListCount As Integer
Dim FullPath As String
Dim openRet As Variant

FilePath = FilePath & "\"

ListCount = lvwFolder.ListItems.Count

For i = 1 To ListCount
If lvwFolder.ListItems(i).Checked = True Then
FullPath = FilePath & lvwFolder.ListItems(i).Text
openRet = ShellOper(FullPath)
End If
Next i

End Sub

attachment.php
 

Attachments

  • New Picture (6).bmp
    1.4 MB · Views: 61
Last edited:
Re: [TUT] VB6 MSAccess Sample using ADO (UPDATED V3 20100216) now with ADD and DataRe

ahh akala ko i open at basahin yung file, di kasi malinaw e
dapat sinabi mo i-open ang file using the associated program

teka bakit desktop handle ang ginamit mo para i execute ang file?
 
Re: [TUT] VB6 MSAccess Sample using ADO (UPDATED V3 20100216) now with ADD and DataRe

ano ba dapat?
 
Re: [TUT] VB6 MSAccess Sample using ADO (UPDATED V3 20100216) now with ADD and DataRe

code
Private Function InsertUser() As Boolean ' function that insert a user
Dim bReturn As Boolean
Dim strQuery As String

Dim cn As ADODB.Connection
Set cn = New ADODB.Connection
cn.ConnectionString = gstrConnectionString
On Error GoTo ERR_LINE

cn.Open
strQuery = "INSERT INTO tblUsers ("
strQuery = strQuery & "UserName, "
strQuery = strQuery & "Password, "
strQuery = strQuery & "FirstName, "
strQuery = strQuery & "LastName, "
strQuery = strQuery & "UserAccess, "
strQuery = strQuery & "Address "
strQuery = strQuery & ")"
strQuery = strQuery & "VALUES "
strQuery = strQuery & "("
strQuery = strQuery & "'" & txtUsername.Text & "', "
strQuery = strQuery & "'" & txtPassword.Text & "', "
strQuery = strQuery & "'" & txtFirstName.Text & "', "
strQuery = strQuery & "'" & txtLastName.Text & "', "
strQuery = strQuery & "'" & cboUserType.Text & "', "
strQuery = strQuery & "'" & txtAddress.Text & "'"
strQuery = strQuery & ")"

Dim cmd As ADODB.Command
Set cmd = New ADODB.Command
cmd.ActiveConnection = cn
cmd.CommandText = strQuery
cmd.CommandType = adCmdText

Dim n As Integer
cmd.Execute n
If n = 1 Then
bReturn = True
MsgBox "User was Added"
Else
bReturn = False
MsgBox "User was not Added"
End If
ERR_RESUME:
cn.Close
Set cn = Nothing
InsertUser = bReturn
Exit Function
ERR_LINE:
bReturn = False
MsgBox Err.Description
Resume ERR_RESUME
End Function

boss, help naman.., napagana ko na to dun sa isang program.. gumagawa ulit ako ng bago..
nag syntx error in INSERT INTO statement .., nung dinebug ko dun nag eeror sa cmd.execute ...ano kaya problema... pati ung UPDATE error din...
 
Re: [TUT] VB6 MSAccess Sample using ADO (UPDATED V3 20100216) now with ADD and DataRe

code


boss, help naman.., napagana ko na to dun sa isang program.. gumagawa ulit ako ng bago..
nag syntx error in INSERT INTO statement .., nung dinebug ko dun nag eeror sa cmd.execute ...ano kaya problema... pati ung UPDATE error din...


Check your code po.
 
Last edited:
Re: [TUT] VB6 MSAccess Sample using ADO (UPDATED V3 20100216) now with ADD and DataRe

code


boss, help naman.., napagana ko na to dun sa isang program.. gumagawa ulit ako ng bago..
nag syntx error in INSERT INTO statement .., nung dinebug ko dun nag eeror sa cmd.execute ...ano kaya problema... pati ung UPDATE error din...

ano ang error message?

kung SQL ang error,
isingit mo to
Debug.Print strQuery
dapat before ng
Dim cmd As ADODB.Command

then run, hayaan mo lang mag error, stop
punta ka sa IMMEDIATE WINDOW
makikita mo dun yung actual VALUE ng strQuery

copy it and paste sa query window ng MSACCESS
or try using ACCESS QUERY ANALYZER

para ma run mo yung query sa database ng diretso

from there makikita mo ang error ng SQL
 
Re: [TUT] VB6 MSAccess Sample using ADO (UPDATED V3 20100216) now with ADD and DataRe

nachecked ko na eh.. may mali ba?
 
Back
Top Bottom