Hi,
I don't know much about VB, and I'm wondering if anyone can help me with its syntax. I have a simple database that keeps track of a "tblDebitNote" table. It has the following attributes:
-DebitNoteID (Autonumber, PK)
-Date (date/time)
-Reference Number (text)
-CD Name (text)
I've created a search form (Please see attachment: screenshot.jpg) so that when the user enters the Date, the ReferenceNumber and click "Search", the CDName can be displayed in the textbox. However, I'm not sure how to do with the SQL statements.
I know I have to create a function called cmdSearch_Click() for the "search" button, and this is the what I have so far:
Is my SQL statement correct? How do I 'call' this SQL statement? How do I get the search results or the text value of the CDName? What is the best way to display the result if there is more than 1?
Really appreciate your time and help.
Gratefully,
aywho
I don't know much about VB, and I'm wondering if anyone can help me with its syntax. I have a simple database that keeps track of a "tblDebitNote" table. It has the following attributes:
-DebitNoteID (Autonumber, PK)
-Date (date/time)
-Reference Number (text)
-CD Name (text)
I've created a search form (Please see attachment: screenshot.jpg) so that when the user enters the Date, the ReferenceNumber and click "Search", the CDName can be displayed in the textbox. However, I'm not sure how to do with the SQL statements.
I know I have to create a function called cmdSearch_Click() for the "search" button, and this is the what I have so far:
Private Sub cmdSearch_Click()
Dim strDate As String
Dim strRefNum As String
Dim strSQL As String
strSQL = "SELECT tblDebitNote.CDName FROM tblDebitNote WHERE strDate = tblDebitNote.Date AND strRefNum = tblDebitNote.RefNum"
----don't know what to do next------
End Sub
Dim strDate As String
Dim strRefNum As String
Dim strSQL As String
strSQL = "SELECT tblDebitNote.CDName FROM tblDebitNote WHERE strDate = tblDebitNote.Date AND strRefNum = tblDebitNote.RefNum"
----don't know what to do next------
End Sub
Is my SQL statement correct? How do I 'call' this SQL statement? How do I get the search results or the text value of the CDName? What is the best way to display the result if there is more than 1?
Really appreciate your time and help.
Gratefully,
aywho