
SQL and Access......lots of help needed!
I'm having a tough time getting my head around SQL. I've only just started
as I need a way to search a database in access, the source is below.....the
titles in acces are "Artist" And "Album", I want to search using the artists
name to give a list of the albums by them.
so far all i have is loads of none working code! everything I've tried
hasn't worked.
thanks..
Wayne...
ps:sorry for the untidy code!
CODE:
Const DBName As String = "mp3 - wayne.mdb"
Dim strPath As String
Dim rsTitles As Recordset
Dim strSQl As String
Dim blnView As Boolean
Private Sub Command1_Click()
With Data1.Recordset
.Delete
.MoveNext
Dim place
place = .EOF
If place Then
.MovePrevious
If .BOF Then
MsgBox "there are no records left", vbInformation, "No Records!"
End If
End If
End With
End Sub
Private Sub Command2_Click()
Data1.Recordset.AddNew
End Sub
Private Sub Command3_Click()
Data1.Recordset.Update
End Sub
Private Sub Command4_Click()
Data1.Recordset.Edit
End Sub
Private Sub Command5_Click()
Dim rs As Recordset
Dim db As Database
Dim strSQl As String
strSQl = "SELECT * FROM Mp3 - wayne"
strSQl = strSQl & " WHERE artist LIKE '*" & Text1.Text & "*'"
Text1.Text = [strSQl]
'SELECT [Artist], [Album] FROM [mp3 - wayne] WHERE [Artist] LIKE
Text1.Text
End Sub
Private Sub SetRecordNumber()
'display record number
Dim intRecordCount As Integer
Dim intCurrentRecord As Integer
intRecordCout = Data1.Recordset.RecordCount
intCurrentRecord = Data1.Recordset.AbsolutePosition + 1
If Data1.Recordset.EOF Then
Data1.Caption "EOF"
Else
Data1.Caption = "Record" & intCurrentRecord & " of " &
intRecordCount
End If
End Sub