convert vbProperCase when saving new entry in combox

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.
 
S

Stuart McCall

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 ...
 
S

Silvio

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 ...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top