![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Dec 2004
Posts: 5
Rep Power: 0
![]() |
Hi all
Can anyone tell me whether the below code is correct? Well I suppose really its a stupid question because it doesn't work so has anybody got any ideas? Private Sub cmdCreateLoan_Click() Dim custID As String custID = txtCustomerNumber.Text Dim individualItemNo As String individualItemNo = txtItem.Text Dim dateOut As Date dateOut = CurrentDate Dim dateBack As Date dateBack = dueDate datLoans.Recordset.AddNew datLoans.RecordSource = "INSERT INTO LoanDetails VALUES('&custID', '&individualItemNo', '&dateOut', '2', '&dateBack', '', '')" datLoans.Refresh End Sub Regards and thanks all James |
|
|
|
|
|
#2 |
|
Expert Programmer
|
Well for a start that's not how you refer to VB variables in a string - you need "INSERT INTO LoanDetails VALUES('" & custID & "', '" & individualItemNo &"', '" & dateOut & "', '2', '" & dateBack & "', '', '')" assuming you need the ' quotes in the actual SQL. However I don't think you can execute SQL on what you're using in that way - take a look at the VisData sample project that came with VB for more info.
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|