syntax for number data type???

Sadie Hewgill

Registered User.
Local time
Today, 16:11
Joined
Oct 18, 2010
Messages
52
So i have this code that adds a new entry to my combo box list, and it works great for text data types. I want "length" to be a number type, but I don't know what to change about the syntax to make this work.

Private Sub Length_NotInList(NewData As String, Response As Integer)
Dim strTmp As String

'Get confirmation that this is not just a spelling error.
strTmp = "Add '" & NewData & "' as a new product category?"
If MsgBox(strTmp, vbYesNo + vbDefaultButton2 + vbQuestion, "Not in list") = vbYes Then

'Append the NewData as a record in the table.
strTmp = "INSERT INTO MachinedParts_Length_in ( Length ) " & _
"SELECT """ & NewData & """ AS field;"
DBEngine(0)(0).Execute strTmp, dbFailOnError

'Notify Access about the new record, so it requeries the combo.
Response = acDataErrAdded
End If
End Sub
 
Try

"SELECT " & NewData & " AS field;"
 

Users who are viewing this thread

Back
Top Bottom