Hello, I wrote a simple Module to update records in a table (called 'Labeldata') and it worked perfectly. However, we recently converted this Access table to a MySQL table (with identical data structure) and now my Module does not work. We also installed ODBC on my PC. Below is a copy of the actual Module code, can you tell me what I have to change (perhaps the 'Set dbs' statement) to get the Module to work? Thank you for your time.
Code:
Option Compare Database
Option Explicit
Function UpdateDatabase (PassOldGenus As String, PassOldSpecies As String, PassNewGenus As String, PassNewSpecies As String, PassTodaysDate As String)
' Updates records in Labeldata table'
Dim dbs As Database
Dim Labelsold As Recordset
Dim Lblfld As Field
Dim label As Integer
Dim Labelstdf As TableDef
Dim fieldtitle As Variant, fieldnum As Integer
Set dbs = CurrentDb
Set Labelstdf = dbs.TableDefs!Labeldata
Set Labelsold = dbs.OpenRecordset("Labeldata")
Labelsold.MoveFirst
Do Until Labelsold.EOF
If Labelsold![Documented_Genus] = PassOldGenus Then
If Labelsold![Documented_Species] = PassOldSpecies Then
Labelsold.Edit
Labelsold![SourceDB] = "SynonymPGM"
Labelsold![Date_Of_Entry] = PassTodaysDate
Labelsold![Documented_Genus] = PassNewGenus
Labelsold![Documented_Species] = PassNewSpecies
Labelsold.Update
End If
End If
Labelsold.MoveNext
Loop
End Function
Last edited by a moderator: