convert vbProperCase when saving new entry in combox

  • Thread starter Thread starter Silvio
  • Start date Start date
S

Silvio

I have a combo box that allows new entry in Not InList event. Everithings
works fine except I can not get to work the vbProperCase when the new entry
is added to the TABLE. It formats correctly in the Msg box but bot in the
table. This is what I have:

Private Sub TxCompany_NotInList(NewData As String, Response As Integer)
On Error GoTo HandleErr
Dim Confirm
Dim strSQL As String


Confirm = MsgBox(StrConv(NewData, vbProperCase) _
& " Not In List." & vbCrLf & _
"Would you like to add it?", vbInformation + vbYesNo, _
"Limited Entry")
If Confirm = vbYes Then
strSQL = " INSERT INTO tblCompany(Company) SELECT """ & NewData & """;"
CurrentDb.Execute strSQL, dbFailOnError
Response = acDataErrAdded
Else
Response = acDataErrContinue
Me.TxCompany = Null
End If

Hellllllpppp!!

Thank you folks.
 
Silvio said:
I have a combo box that allows new entry in Not InList event. Everithings
works fine except I can not get to work the vbProperCase when the new
entry
is added to the TABLE. It formats correctly in the Msg box but bot in the
table. This is what I have:

Private Sub TxCompany_NotInList(NewData As String, Response As Integer)
On Error GoTo HandleErr
Dim Confirm
Dim strSQL As String


Confirm = MsgBox(StrConv(NewData, vbProperCase) _
& " Not In List." & vbCrLf & _
"Would you like to add it?", vbInformation + vbYesNo, _
"Limited Entry")
If Confirm = vbYes Then
strSQL = " INSERT INTO tblCompany(Company) SELECT """ & NewData & """;"
CurrentDb.Execute strSQL, dbFailOnError
Response = acDataErrAdded
Else
Response = acDataErrContinue
Me.TxCompany = Null
End If

Hellllllpppp!!

Thank you folks.

Convert NewData before passing to both the messagebox and the sql:

NewData = StrConv(NewData, vbProperCase)
Confirm = MsgBox(NewData ...
 
Works great. Thank you.

Stuart McCall said:
Convert NewData before passing to both the messagebox and the sql:

NewData = StrConv(NewData, vbProperCase)
Confirm = MsgBox(NewData ...
 
Back
Top