[Resolved]Trouble Inserting record into table.
Hey, I can create my table in my database and everthing else, but I'm having trouble inserting the records. Can someone tell me what's wrong here? I don't get any errors, but when I open the table in Access, there are no records. Here's my code:
VB Code:
'connect to the database
Dim Cnn As ADODB.Connection
Dim SQL As String
Set Cnn = New ADODB.Connection
Cnn.Open ConnectionString:="Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source= c:\windows\system\kamo.mdb;"
'set table = to the category added
table = txtcategory.Text
'Loop through the filelistbox getting info on the files
MusicMaster.File1.Path = txtpath.Text
On Error Resume Next
For x = 0 To MusicMaster.File1.ListCount - 1
fname = MusicMaster.File1.Path & "\" & MusicMaster.File1.List(x)
Call ReadMP3(fname, True, True)
'Store the MP3 info as strings
strFilepath = fname
strFileName = MusicMaster.File1.List(x)
strFileSize = FileLen(fname)
strArtist = GetMP3Info.Artist
strTitle = GetMP3Info.Songname
strAlbum = GetMP3Info.Album
strTrack = GetMP3Info.Track
strFrequency = GetMP3Info.Frequency
strBitrate = GetMP3Info.Bitrate
strLength = GetMP3Info.Duration
'Use SQL to insert the information in the strings into the table
SQL = "INSERT into " & table & " (Filepath,Filename,Filesize,Artist,Title,Album,Frequency,Bitrate,Length,Track#)VALUES ('" & strFilepath & "','" & strFileName & "','" & strFileSize & "','" & strArtist & "','" & strTitle & "','" & strAlbum & "','" & strTrack & "','" & strFrequency & "','" & strBitrate & "','" & strLength & "')"
Next 'do the same thing for each item in the filelistbox
'Update the combocategory on the main form
Call WriteTextFile 'this is irrelevant to the SQL stuff- Igore it.
Still Not adding records!
Ok, I added that line, but it's still not adding any records to my table!