473,574 Members | 3,033 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

help with changing code from access to mysql database

17 New Member

I have a caller ID software that I would like to change from Microsoft Access database to Mysql and was wondering if somebody could help me. The code i currently have is:

Expand|Select|Wrap|Line Numbers
  2. Private Sub OpenDataBase()
  3.     Set fo = New FileSystemObject
  4.     Set wrk = CreateWorkspace("", "admin", "", dbUseJet)
  5.      If Not fo.FileExists(m_stDataPath & "callerid.mdb") Then
  6.         Set db = wrk.CreateDatabase(m_stDataPath & "callerid.mdb", dbLangGeneral)
  7.         CreatePhoneDB
  8.     Else
  9.         Set db = wrk.OpenDataBase(m_stDataPath & "callerid.mdb")
  10.     End If
  11.     Set rs = db.OpenRecordset("PhoneCalls", dbOpenTable)
  12.  End Sub
  13.  Private Sub CloseDatabase()
  14.     db.Close
  15.     wrk.Close
  16.     Set db = Nothing
  17.     Set wrk = Nothing
  18.     Set fo = Nothing
  19. End Sub
  20.   Private Sub AddRecord()
  21.     Dim lID As Long
  22.     Select Case Len(frmLineInfo.Number.Text)
  23.       Case 0
  24.         frmLineInfo.Number.Text = "No Number"
  25.       Case 1
  26.         Select Case frmLineInfo.Number.Text
  27.           Case "O"
  28.             frmLineInfo.Number.Text = "Unavailable"
  29.             frmLineInfo.CallName.Text = "Unavailable"
  30.           Case "P"
  31.             frmLineInfo.Number.Text = "Blocked"
  32.             frmLineInfo.CallName.Text = "Blocked"
  33.        End Select
  34.     End Select
  35.     Select Case Len(frmLineInfo.CallName.Text)
  36.       Case 0
  37.         frmLineInfo.CallName.Text = "-"
  38.       Case 1
  39.         Select Case frmLineInfo.CallName.Text
  40.           Case "O"
  41.             frmLineInfo.CallName.Text = "Unavailable"
  42.           Case "P"
  43.             frmLineInfo.CallName.Text = "Blocked"
  44.         End Select
  45.     End Select
  46.      With rs
  47.         If (.RecordCount > 0) Then
  48.             .MoveLast
  49.             lID = .Fields("id") + 1
  50.         Else
  51.             lID = 1
  52.         End If
  53.         .AddNew
  54.         .Fields("id") = lID
  55.         .Fields("datetime") = Now
  56.         .Fields("number") = frmLineInfo.Number.Text
  57.         .Fields("name") = frmLineInfo.CallName.Text
  58.         .Update
  59.     End With
  60.  End Sub
  61.  Private Function CreatePhoneDB() As Recordset
  62.     Dim tbl As TableDef
  63.     Set tbl = db.CreateTableDef("PhoneCalls")
  64.     With tbl
  65.         .Fields.Append .CreateField("id", dbLong, 4)
  66.         .Fields.Append .CreateField("datetime", dbDate, 4)
  67.         .Fields.Append .CreateField("number", dbText, 20)
  68.         .Fields.Append .CreateField("name", dbText, 20)
  69.         db.TableDefs.Append tbl
  70.     End With
  71.     Set db = wrk.OpenDataBase(m_stDataPath & "callerid.mdb")
  72.     Set tbl = db!phonecalls
  73.     Set idx = tbl.CreateIndex("DateTime")
  74.     idx.Fields.Append idx.CreateField("datetime")
  75.     tbl.Indexes.Append idx
  76.   End Function
Nov 11 '08 #1
4 1619
8,127 Recognized Expert Expert
try to use ADODB library for the purpose.
Nov 11 '08 #2
17 New Member
Sorry im a php coder not a VB6 coder. I was wondering if you could be a little more specific? any links for this would be appreciated.

Nov 11 '08 #3
8,127 Recognized Expert Expert
you mean to say all the code you have posted is in PHP ?

why you have posted the question here , why not in PHP forum ?
Nov 11 '08 #4
17 New Member
no the code is vb6 no php. the vb6 code needs changing from a access database to mysql database
Nov 11 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Neil | last post by:
Hi, I hope this question isn't too far off topic....I'm almost at my wits end trying to figure this out. I have a Mysql database and I wish to automate the backup of the database because I don't wish to rely on the web host doing so. I am using the "dbsender.php" script, which is written for this exact purpose (available at...
by: Dafella | last post by:
The following is code from Xeoport. It is suppose to access my pop3 account and load email into Mysql database. It's not inserting and there is no log or anything to tell me why. Here is the page. http://www.dafella.com/xeoport/ The original coder left no contact info. The reason I think it's the code is because of another issue.
by: Mark Wilson CPU | last post by:
A colleague has written a prototype program in PHP, using a MySQL database. It's a relatively simple app, with a restricted set of mysql commands used (see below). The MySQL DB is being replaced with an Oracle DB (same schema). My plan 1) globally replace the few mysql commands with intermediate equivalents (such as myDB_connect for...
by: cooldv | last post by:
i am running a website on Windows 2000 server with ASP 3 webpages and Access 2000 database. (with a hosting company) traffic is slow at this time but expect to grow. lately i have been reading about sql database and sql server, specially this article: http://www.aspfaq.com/show.asp?id=2195 will someone help me understand: 1. with *SQL...
by: David Heller | last post by:
I have this schema I exported from a database running mysql version 4.01 I'm trying to create this table on a server running mysql 3.23 I keep getting a syntax error near line 11 (I added the line numbers for clarity. I think it has a problem with the Table Field "ORDER#" I do have it quoted as shown below so why do I keep getting syntax...
by: Daven Thrice | last post by:
Hi, I've converted the tables from an old Access application to MySql format. I then linked the tables into access using MyODBC and everything works great (on my computer). For now, I want to keep Access as a front end, and move the tables to the Internet. I feel like I'm lost in a maze or something with some really basic questions. What...
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- Hello, I have a very simple problem but cannot seem to figure it out. I have a very simple php script that sends a test email to myself. When I...
by: Vladislav Moltchanov | last post by:
Recently I have changed from Acc97 to Acc2000 (I had to supply some data entry tools for field data collection for users still using Acc97). Among lot of other complications coming with Acc2000 (compared with very reliable acc97) I have got problem with Help: In access 2000 all topics with DAO are listed in index but otherwise not available,...
by: PHP_Paul | last post by:
Ok, I'm trying to poineer into the wonderful area of PHP/MySQL programming, but I'm having some difficulties. http://www.paulhq.com/php/freepage.html should register, but when anyone fills something out, it returns a MySQL error: Could not insert data because You have an error in your SQL syntax; check the manual that corresponds to your MySQL...
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.