|
luckyCO
|
for access database only
for you to create data you have to use ms access to create database or use visual database available in vb's addin menu.
if you want to that to be automatic then you have create a sample database without table in it and write a program to copy it to any destination you want and you can start to access.
you can paste this code at the topmost part of your code form
Public Declare Function CopyFile Lib "kernel32" Alias "CopyFileA" (ByVal lpExistingFileName As String, ByVal lpNewFileName As String, ByVal bFailIfExists As Long) As Long
then you can call it like below copyfile ("C:\h.mdb",app.path & "\good.mdb",true)
call the sub program to create tables
Private Sub Command1_Click()
Dim SQLtxt a string Dim dbn as string
SQLtxt = "CREATE TABLE test (ID COUNTER PRIMARY KEY,Mobile Memo,Message Memo,ReportCode memo) "
' As programer you can loop the table creation into any number of time with different parameters.
if CreateTable("students",SQLtxt)=true then Msgbox "database table was created successfully" else Msgbox "Table creation failed" end if
End Sub
Public function CreateTable(dbname As String, txtSQL As String) as boolean
dim dbConntectionString as string dbConntectionString ="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & app.path & "\" & trim(dbname) & ".mdb;Persist Security Info=False"
on error goto errh Dim CNN As New ADODB.Connection
CNN.Open dbConntectionString
CNN.Execute txtSQL , iAffected, adExecuteNoRecords
CNN.Close
CreateTable=true exit function errh:CreateTable=false
End Sub
If it is not clear let me know Or given me sample project to illustrate and plz be elaborate in what u want.
bye
|
|
|
|
|
|
*dhtml (m)
|
I kinda suspect what the guy was asking for was how to do all those connection with jet enginexxx to an access database. Such that you can now control the access database using the ado or adoc control with data-binding to objects, \ At least that method does not take so many codes and is easy to use and you can still perform basic operations like move forward, back and even search with no serious coding. @lucky - u are the teacher - i was just passing by - and keep up the good job
|
|
|
|
|
|
luckyCO
|
I kinda suspect what the guy was asking for was how to do all those connection with jet enginexxx to an access database. Such that you can now control the access database using the ado or adoc control with data-binding to objects, \ At least that method does not take so many codes and is easy to use and you can still perform basic operations like move forward, back and even search with no serious coding. @lucky - u are the teacher - i was just passing by - and keep up the good job
For beginners, using Last ,back,Forward and first record set method can be managed. But to the person's instrest the way I code it will enable you to have power and managerial control over the performance of your program. For me I do write code that connects to database and return a recordset for me. Again I write function that can retrieve one item for me from a particular table, another code that will check whether a particular item is extisting such dat I will not insert it again. When the time comes I will call the functions for use. Am waiting for him to tell me what he want s them I will reply back. Thanks
|
|
|
|
|
|
debeginin
|
Please house Ineed you guys to tell me the IDE I can use for VB6.0 and let me into a very good VB textbook for a beginner.Thanks.
|
|
|
|
|
|
faoni572 (m)
|
Get your paypal account verified right here in nigeria. Make all your withdrawals from our local bank here in Nigeria The secret method of opening and operating a Paypal account right from Nigeria; How to get your Paypal account verified How to get your own US virtual office address How to get your own US phone number
How to buy things from any online shop including eBay, Amazon, yahoo, etc and ship to Nigeria; How and Where to open a US bank account for non residents, etc
pay #1000 to FIDELITY BANK PLC EMMANUEL CHUKWUEBUKA IBE 023605010018814 SEND YOUR DEPOSIT SLIP NO AND YOUR EMAIL ADDRESS TO 08036993163
Are we discussing pay pal here? Pls for God's sake this thread is for Visual Basic 6.0 programming. You can go to bussiness section or advert section to advertise your products.
|
|
|
|
|
|
kossy (m)
|
hi, luckyco and co. pls i need to use the shell command. Can you help me with that? and how do i print a database. I used access as the database. Which web site is the best to get online help on vb6.0
|
|
|
|
|
|
luckyCO
|
hi, luckyco and co. pls i need to use the shell command. Can you help me with that? and how do i print a database. I used access as the database. Which web site is the best to get online help on vb6.0
You may not be able to print database rather information Table(s) within the database. You either use Crystal,active and datareport to display the data from table(s) then printing will be easy. You can go to www.4shared.com and type any type book u like otherwise google it out. Please house Ineed you guys to tell me the IDE I can use for VB6.0 and let me into a very good VB textbook for a beginner.Thanks.
Use vb6.0 IDE service park 6. Go to market and buy then download service park 6 from microsoft site. thanks
|
|
|
|
|
|
textmypage (m)
|
where can i download a java file editor?i need a software or application that i can use 2 edit opera mini 4 .anyone wit idea shud email it to textmypage@yahoo.com TY
|
|
|
|
|
|
luckyCO
|
Hope there is no much questions from you on Vb 6.0. For those who want migrate from vb.6.0 to vb.net 2005 I have created another thread similar to this one, so feel free to post your questions. Thanks and may God bless.
|
|
|
|
|
|
francisman
|
Guys, check out this site, you'd find it useful : www.nairabooks.com for all your orders for new and used books, magazines, journals in all areas.
|
|
|
|
|
|
luckyCO
|
No more questions?
|
|
|
|
|
|
RuuDie (m)
|
Hi, can anybody help out with VB6 codes that can pull data saved in MS-Access tables and into a MS-Excel or MS-Word document 
|
|
|
|
|
|
coolgenius
|
luckyCO
Where do you find the time to do this. I'm a programmer too and have a clue into your world. Are you employed?
|
|
|
|
|
|
luckyCO
|
Hi, can anybody help out with VB6 codes that can pull data saved in MS-Access tables and into a MS-Excel or MS-Word document  I will send you the code later, although I have sent somewhere on this thread. To do that is very simple, I may give you crew incase you can do it alone Export to excel dim obj as object set obj=createobject("Excel.Application") . . . . Alternatively you can reference the object by using reference menu. That one is more user freindly. I will give you the entire code later. luckyCO
Where do you find the time to do this. I'm a programmer too and have a clue into your world. Are you employed?
Well am self employed. I do this on my relaxation time. Am not doing to attract applause but to help the much I can. Thanks
|
|
|
|
|
|
kossy (m)
|
Hi, luckyco,pls i have similar question on excel. How do i fill the rows and columns with data, or preferably if i am using ms word. How do i pop it (the file) out at run time. Thanks man for the site you gave me as reply to my previous question. it helped a lot
|
|
|
|
|
|
kossy (m)
|
Oops, my bad! I have seen the code for excel on page 6
|
|
|
|
|
|
luckyCO
|
I dont Have time re-write the code giving you exactly what you demanded for. In any case
To export the MS Access , I filled it on the MSH grid before exporting it to excel.
Call the function below as follw
Control neeed; Command button and MSHFlexgrid
Private Sub Command1_Click() Dim ConS as string,SQL as string SQL="Select * from mytable" cons="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.path & "\<database>.mdb;Persist Security Info=False
' fill the grid FillInMSH MSHFlexGrid1,ConS ,SQL
'export to excel PrintMsh SHFlexGrid1
End Sub
Public Function FillInMSH(MSH1 As MSHFlexGrid, ConectionString As String, SQLstr As String, Optional txtHoldNum As String, Optional SumIt As Boolean, Optional DontDo As Integer, Optional DontDo1 As Integer, Optional FormatWithSense As Boolean, Optional GenSerialOnFirstRow As Boolean, Optional RowPosition As Integer, Optional SummaryXter As String, Optional ColOnly As Integer) On Error GoTo errh Dim StoreVA(122) As Single, LP As Integer, HP1 As String
Dim j As Long, I As Integer, db As New ADODB.Recordset Dim rs As New ADODB.Connection rs.ConnectionString = ConectionString rs.Open Set db = rs.Execute(SQLstr)
MSH1.Refresh Cancel_Grid_Fill = False
MSH1.Rows = 2
MSH1.Cols = db.Fields.Count For j = 0 To db.Fields.Count - 1 MSH1.TextMatrix(0, j) = db.Fields(j).Name MSH1.TextMatrix(1, j) = "" Next j
j = 0
Do While Not db.EOF j = j + 1 MSH1.Rows = j + 1
For I = 0 To db.Fields.Count - 1 MSH1.TextMatrix(j, I) = ""
If IsNull(db.Fields(I).Value) = False Then
If Val(txtHoldNum) > 10 And SumIt = True And db.Fields(I).Type < 120 Then If ColOnly = 0 Then StoreVA(I) = Val(db.Fields(I).Value) + StoreVA(I) ElseIf ColOnly = I Then StoreVA(I) = Val(db.Fields(I).Value) + StoreVA(I) End If
If I <> DontDo And I <> DontDo1 And FormatWithSense = True Then MSH1.TextMatrix(j, I) = " " & Format(db.Fields(I).Value, "0,000.00") Else MSH1.TextMatrix(j, I) = " " & db.Fields(I).Value End If
ElseIf db.Fields(I).Type < 120 And (I = DontDo Or I = DontDo1) Then HP1 = db.Fields(I).Value
If FormatWithSense = True Then If Val(HP1) - Int(Val(HP1)) = 0 Then HP1 = Format(HP1, "0,0") Else HP1 = Format(HP1, "0,0.00") End If End If
MSH1.TextMatrix(j, I) = " " & HP1 Else MSH1.TextMatrix(j, I) = " " & db.Fields(I).Value End If
End If
If GenSerialOnFirstRow = True And I = RowPosition Then MSH1.TextMatrix(j, I) = j End If
Next I db.MoveNext CounterProgress = j DoEvents If Cancel_Grid_Fill = True Then If MsgBox("Are you sure you want to cancel this process", vbQuestion + vbYesNo, "Choose either yes or no") = vbNo Then: Cancel_Grid_Fill = False: Exit Function Exit Function End If
'If CancelNexted = True Then CancelNexted = False: Exit Function
Loop
db.Close rs.Close
If Val(txtHoldNum) > 10 Then MSH1.Rows = MSH1.Rows + 1 MSH1.Rows = MSH1.Rows + 1
For I = 0 To MSH1.Cols - 1
If DontDo = I And I <> DontDo1 Then MSH1.TextMatrix(MSH1.Rows - 1, I) = StoreVA(I) Else
If FormatWithSense = True Then MSH1.TextMatrix(MSH1.Rows - 1, I) = IIf(StoreVA(I) <> 0, Format(StoreVA(I), "0,000.00"), "") Else MSH1.TextMatrix(MSH1.Rows - 1, I) = " " & IIf(StoreVA(I) <> 0, Format(StoreVA(I), "0,0"), "") End If
End If Next I If SummaryXter = "" Then MSH1.TextMatrix(MSH1.Rows - 1, 1) = "Summary:" Else MSH1.TextMatrix(MSH1.Rows - 1, 1) = SummaryXter End If
End If
Exit Function
errh: End Function
Public Sub PrintMsh(Mhs As Control, Optional KIM As Integer) If Global_Can_Change_Setting = False Then MsgBox "You don't have right to export your report to excel", vbCritical, "Right violated"
Exit Sub End If
If MsgBox("Are you sure you want to export the data to excel", vbQuestion + vbYesNo, "Choose either yes or no") = vbNo Then Exit Sub
On Error GoTo errh Dim D As Object, K As Long, j As Long Set D = CreateObject("Excel.Application") D.Visible = True D.Workbooks.Add Dim II As Long Dim i9 As Long
Dim i8 As Integer i8 = CInt(Mhs.Rows / 65536) - 3 For K = 1 To i8 D.Worksheets.Add Next K
i8 = 1 i9 = 65536 II = 1 Dim M As Long M = 1 Dim DF0 As Integer If KIM <> 0 Then DF0 = KIM + 1
If KIM = 0 Then DF0 = KIM + 1
For K = 0 To Mhs.Rows - 1 If K = i9 Then II = II + 1: i9 = i9 + 65536: M = 1 If II = i8 Then i8 = i8 + 1:
D.Worksheets(II).Columns.Font.Size = 8 D.Worksheets(II).Rows(1).Font.Bold = True D.Worksheets(II).Rows.AutoFit D.Worksheets(II).Columns.AutoFit End If
For j = 1 To Mhs.Cols - DF0
D.Worksheets(II).Cells(M, j + 1) = Trim(Mhs.TextMatrix(K, j))
Next j
D.Worksheets(II).Cells(M, 1) = M - 1 M = M + 1 Next K
D.Worksheets(II).Cells(1, 1) = "S/N"
D.Worksheets(II).Columns.Font.Size = 8 D.Worksheets(II).Rows(1).Font.Bold = True D.Worksheets(II).Rows.AutoFit D.Worksheets(II).Columns.AutoFit Exit Sub errh: End Sub
|
|
|
|
|
|
luckyCO
|
Hope there is no more questions? In case I ve not answered your questions, you may repost it. Thanks
|
|
|
|
|
|
kheme (m)
|
hi. i'm trying to write a sudoku puzzle generator with vb.net but my algorithm seems correct, but runs out of numbers at some stages while generating the puzzle. can anyone look into ma code and see why? Public Class home Public rp = 0, arr(8, 8) As Integer, rsv(8, 8) As List(Of Integer), ax(2, 2)
Public Function sot(ByRef ar As Array) Dim o, p, q, r For o = 0 To 8 If (ar(o) = Nothing) Then For p = o To 1 Step -1 q = ar(p) r = ar(p - 1) ar(p) = r ar(p - 1) = q Next End If Next Return Nothing End Function
Public Function rnd(ByVal x As Integer, ByVal y As Integer) Dim r1 = Nothing, rd As New Random For a As Integer = 0 To 8 If (arr(x, a) <> 0 And rsv(x, y).IndexOf(arr(x, a)) <> -1) Then rsv(x, y).RemoveAt(rsv(x, y).IndexOf(arr(x, a))) End If
If (arr(a, y) <> 0 And rsv(x, y).IndexOf(arr(a, y)) <> -1) Then rsv(x, y).RemoveAt(rsv(x, y).IndexOf(arr(a, y))) End If Next
If (x >= 0 And x <= 2 And y >= 0 And y <= 2) Then For a1 As Integer = 0 To 2 For b1 As Integer = 0 To 2 If (arr(a1, b1) <> Nothing And rsv(x, y).IndexOf(arr(a1, b1)) <> -1) Then rsv(x, y).RemoveAt(rsv(x, y).IndexOf(arr(a1, b1))) End If Next Next End If If (x >= 0 And x <= 2 And y >= 3 And y <= 5) Then For a1 As Integer = 0 To 2 For b1 As Integer = 3 To 5 If (arr(a1, b1) <> Nothing And rsv(x, y).IndexOf(arr(a1, b1)) <> -1) Then rsv(x, y).RemoveAt(rsv(x, y).IndexOf(arr(a1, b1))) End If Next Next End If If (x >= 0 And x <= 2 And y >= 6 And y <= 8) Then For a1 As Integer = 0 To 2 For b1 As Integer = 6 To 8 If (arr(a1, b1) <> Nothing And rsv(x, y).IndexOf(arr(a1, b1)) <> -1) Then rsv(x, y).RemoveAt(rsv(x, y).IndexOf(arr(a1, b1))) End If Next Next End If
If (x >= 3 And x <= 5 And y >= 0 And y <= 2) Then For a1 As Integer = 3 To 5 For b1 As Integer = 0 To 2 If (arr(a1, b1) <> Nothing And rsv(x, y).IndexOf(arr(a1, b1)) <> -1) Then rsv(x, y).RemoveAt(rsv(x, y).IndexOf(arr(a1, b1))) End If Next Next End If If (x >= 3 And x <= 5 And y >= 3 And y <= 5) Then For a1 As Integer = 3 To 5 For b1 As Integer = 3 To 5 If (arr(a1, b1) <> Nothing And rsv(x, y).IndexOf(arr(a1, b1)) <> -1) Then rsv(x, y).RemoveAt(rsv(x, y).IndexOf(arr(a1, b1))) End If Next Next End If If (x >= 3 And x <= 5 And y >= 6 And y <= 8) Then For a1 As Integer = 3 To 5 For b1 As Integer = 6 To 8 If (arr(a1, b1) <> Nothing And rsv(x, y).IndexOf(arr(a1, b1)) <> -1) Then rsv(x, y).RemoveAt(rsv(x, y).IndexOf(arr(a1, b1))) End If Next Next End If
If (x >= 6 And x <= 8 And y >= 0 And y <= 2) Then For a1 As Integer = 6 To 8 For b1 As Integer = 0 To 2 If (arr(a1, b1) <> Nothing And rsv(x, y).IndexOf(arr(a1, b1)) <> -1) Then rsv(x, y).RemoveAt(rsv(x, y).IndexOf(arr(a1, b1))) End If Next Next End If If (x >= 6 And x <= 8 And y >= 3 And y <= 5) Then For a1 As Integer = 6 To 8 For b1 As Integer = 3 To 5 If (arr(a1, b1) <> Nothing And rsv(x, y).IndexOf(arr(a1, b1)) <> -1) Then rsv(x, y).RemoveAt(rsv(x, y).IndexOf(arr(a1, b1))) End If Next Next End If If (x >= 6 And x <= 8 And y >= 6 And y <= 8) Then For a1 As Integer = 6 To 8 For b1 As Integer = 6 To 8 If (arr(a1, b1) <> Nothing And rsv(x, y).IndexOf(arr(a1, b1)) <> -1) Then rsv(x, y).RemoveAt(rsv(x, y).IndexOf(arr(a1, b1))) End If Next Next End If
Try arr(x, y) = rsv(x, y)(rd.Next(0, rsv(x, y).Count)) Catch ex As Exception
End Try Return Nothing End Function
Private Sub home_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim a = 0, b = 0, c = 0, n For a = 0 To 8 For b = 0 To 8 n = "s" & a & b rsv(a, b) = New List(Of Integer) For c = 1 To 9 rsv(a, b).Add(c) Next rnd(a, b) Panel2.Controls.Item(n).text = arr(a, b) Next Next
End Sub
Private Sub RefreshToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RefreshToolStripMenuItem.Click rp = 0 Array.Clear(arr, 0, 81) home_Load(Nothing, Nothing) End Sub End Class
i've attached screen shots, the "0" in the puzzle are the places where the algorithm runs out of numbers to put cos the next number to put cannot be placed there due to the rules of sudoku. i need help guys!
|
|
|
|
|
|
kossy (m)
|
Hi LuckyCo, I am afraid there is still much to ask. These lines has solved half of my problem On Error GoTo errh Dim D As Object, K As Long, j As Long Set D = CreateObject("Excel.Application") D.Visible = True D.Workbooks.Add
It opens a file for me in excel but nothing was written into it. The code u gave was too complex for now.
1. I am using ADO datalink object and not ADOBD but database creation is not the problem for now
Assuming, i have this as the database
name destination distance tunde london 6000 Kayode Paris 3453 LuckyCo Lagos 23
Please, write the (simple code) that will put all these in the excel file that was opened. If possible u might not even make use of the database. I would tr that out myself Thanks.
|
|
|
|
|
|
kossy (m)
|
kheme , I am afraid, u might need to try this out in vb6.0. Maybe then some of use might have time to look into it. Or preferably, u take it to the vb.net forum. Response will be faster there than here.
|
|
|
|
|
|
kossy (m)
|
I have been able to finish tge program thanks to u. the only problem i am facing now is how to arrange the output properly. I need to know how to use the font, bold etc at the programming level.
Note: the output file is attached
|
|
|
|
|
|
segun12
|
well sorry people in the house iam here to introduce a property 4 sale in ABUJA. A DUPLEX 5BEDROOM 2SITTING ROOM INTERLOCK SURROUNDING, THIS IS GOING FOR 80M.PLS FOR ANY INFORMATION CONTACT ME ON 08033054149
|
|
|
|
|
|
luckyCO
|
D.Worksheets(II).Columns.Font.Size = 8 D.Worksheets(II).Rows(1).Font.Bold = True D.Worksheets(II).Rows.AutoFit D.Worksheets(II).Columns.AutoFit
From my sub program you may try changes the properties above and see what it will give you dat is the way I arranged the font and things like dat.
|
|
|
|
|
|
legendprac (m)
|
pls someone should help me on these topics on assembly language: what is an assembler constructor; file i/o program segmentation and linkage; interpretive routine
|
|
|
|
|
|
legendprac (m)
|
pls someone should help me on these topics on assembly language: what is an assembler constructor; file i/o program segmentation and linkage; interpretive routine
|
|
|
|
|
|
|
|
luckyCO
|
I don't have much knowledge in Assembly Language. But still yet you can google it out.
|
|
|
|
|
|
moore20
|
hi lucky still xpecting your reply have a splendid day
|
|
|
|
|
|
luckyCO
|
hi lucky still xpecting your reply have a splendid day
Plz can u help me ask your questions again?
|
|
|
|
|
|
legendprac (m)
|
pls someone should help me on these topics on assembly language: what is an assembler constructor; file i/o program segmentation and linkage; interpretive routine
|
|
|
|
|
|
kossy (m)
|
Pls i need to know if i can use vb6.0 to write program that can help me sign in into yahoomail for example. If not what programming language is best for that.
|
|
|
|
|
|