R
Rob W
Greetings,
I hope this is the correct forum for such a post as I'm writing a vb.net
application to an ms access database (accdb).
The code below fails on a syntax error.
From slowly building the code/SQL up, the error is because the syntax used
to insert TWO values for the single database Integer field cTelephone is
incorrect.
I want them to be concatenated together, can anyone please help or advise a
suitable resource or forum that could help.
I did try varying combinations using '+' and '&' without success.
Note: The sql work inserting string/integer values prior to trying to insert
the telephone number value.
Thanks
Rob
'Code to insert telphone value
" & Me.cboSTDCode.Text & Me.txtTelephone.Text & "
'Full SQL code
Dim sqlInsertMember As String = _
"INSERT INTO Members (cMembershipId, cTitle, CSurname, CforeNames,
cInitials, cWRorBranch, " _
+ "cHouseNum, cAddressLine1, cAddressLine2, cTown, cCity, cCounty, " _
+ "cPostcode, cDeceased, cMobile, cTelephone) VALUES ('" & Me.txtMemNum.Text
& "', " _
+ " '" & Me.cboTitle.Text & "', '" & Me.txtSurname.Text & "', " _
+ " '" & Me.txtForename.Text & "', '" & Me.lblInitialsReadable.Text & "', "
_
+ " '" & Me.txtBranch.Text & "', " _
+ " '" & Me.txtHouseOrFlatNum.Text & "', '" & Me.txtAddress1.Text & "', " _
+ " '" & Me.txtAddress2.Text & "', '" & Me.cboTown.Text & "', " _
+ " '" & Me.cboCity.Text & "', '" & Me.cboCounty.Text & "', " _
+ " '" & Me.txtPostCode.Text & "', '" & CType(Me.chkDeceased.Checked,
Integer) & "', " _
+ " " & Me.txtMobile.Text & ", " & Me.cboSTDCode.Text & Me.txtTelephone.Text
& ")"
I hope this is the correct forum for such a post as I'm writing a vb.net
application to an ms access database (accdb).
The code below fails on a syntax error.
From slowly building the code/SQL up, the error is because the syntax used
to insert TWO values for the single database Integer field cTelephone is
incorrect.
I want them to be concatenated together, can anyone please help or advise a
suitable resource or forum that could help.
I did try varying combinations using '+' and '&' without success.
Note: The sql work inserting string/integer values prior to trying to insert
the telephone number value.
Thanks
Rob
'Code to insert telphone value
" & Me.cboSTDCode.Text & Me.txtTelephone.Text & "
'Full SQL code
Dim sqlInsertMember As String = _
"INSERT INTO Members (cMembershipId, cTitle, CSurname, CforeNames,
cInitials, cWRorBranch, " _
+ "cHouseNum, cAddressLine1, cAddressLine2, cTown, cCity, cCounty, " _
+ "cPostcode, cDeceased, cMobile, cTelephone) VALUES ('" & Me.txtMemNum.Text
& "', " _
+ " '" & Me.cboTitle.Text & "', '" & Me.txtSurname.Text & "', " _
+ " '" & Me.txtForename.Text & "', '" & Me.lblInitialsReadable.Text & "', "
_
+ " '" & Me.txtBranch.Text & "', " _
+ " '" & Me.txtHouseOrFlatNum.Text & "', '" & Me.txtAddress1.Text & "', " _
+ " '" & Me.txtAddress2.Text & "', '" & Me.cboTown.Text & "', " _
+ " '" & Me.cboCity.Text & "', '" & Me.cboCounty.Text & "', " _
+ " '" & Me.txtPostCode.Text & "', '" & CType(Me.chkDeceased.Checked,
Integer) & "', " _
+ " " & Me.txtMobile.Text & ", " & Me.cboSTDCode.Text & Me.txtTelephone.Text
& ")"