Paul Cooke
Registered User.
- Local time
- Today, 14:36
- Joined
- Oct 12, 2001
- Messages
- 288
Hi guys,
I have added some code to a combo box to add items to the list if they are not already there and would like to know if anyone could tell me what I would need to do to change the item added to Propercase so it is added to the table as "Home Choice" not "home choice"
The code I have already in the NotInlist event is
Private Sub RXProductionName_NotInList(NewData As String, Response As Integer)
On Error GoTo RXProductionName_NotInList_Err
Dim intAnswer As Integer
Dim strSQL As String
intAnswer = MsgBox("The Production or Event name " & Chr(34) & NewData & _
Chr(34) & " is not currently listed." & vbCrLf & vbCrLf & _
"Is spelling correct? If so" & vbCrLf & _
"Would you like to add it to the list now?" _
, vbQuestion + vbYesNo, "Production / Event Name")
If intAnswer = vbYes Then
strSQL = "INSERT INTO ProductionsEventNames([ProductionName]) " & _
"VALUES ('" & NewData & "');"
DoCmd.SetWarnings False
DoCmd.RunSQL strSQL
DoCmd.SetWarnings True
MsgBox "The new Production / Event name has been added to the list." _
, vbInformation, "Production / Event Name"
Response = acDataErrAdded
Else
MsgBox "Please choose a Production / Event Name from the list." _
, vbInformation, "Production / Event Name"
Response = acDataErrContinue
End If
RXProductionName_NotInList_Exit:
Exit Sub
RXProductionName_NotInList_Err:
MsgBox Err.Description, vbCritical, "Error"
Resume RXProductionName_NotInList_Exit
End Sub
Any help would be gratefully appriciated!
Thanks guys
Paul
I have added some code to a combo box to add items to the list if they are not already there and would like to know if anyone could tell me what I would need to do to change the item added to Propercase so it is added to the table as "Home Choice" not "home choice"
The code I have already in the NotInlist event is
Private Sub RXProductionName_NotInList(NewData As String, Response As Integer)
On Error GoTo RXProductionName_NotInList_Err
Dim intAnswer As Integer
Dim strSQL As String
intAnswer = MsgBox("The Production or Event name " & Chr(34) & NewData & _
Chr(34) & " is not currently listed." & vbCrLf & vbCrLf & _
"Is spelling correct? If so" & vbCrLf & _
"Would you like to add it to the list now?" _
, vbQuestion + vbYesNo, "Production / Event Name")
If intAnswer = vbYes Then
strSQL = "INSERT INTO ProductionsEventNames([ProductionName]) " & _
"VALUES ('" & NewData & "');"
DoCmd.SetWarnings False
DoCmd.RunSQL strSQL
DoCmd.SetWarnings True
MsgBox "The new Production / Event name has been added to the list." _
, vbInformation, "Production / Event Name"
Response = acDataErrAdded
Else
MsgBox "Please choose a Production / Event Name from the list." _
, vbInformation, "Production / Event Name"
Response = acDataErrContinue
End If
RXProductionName_NotInList_Exit:
Exit Sub
RXProductionName_NotInList_Err:
MsgBox Err.Description, vbCritical, "Error"
Resume RXProductionName_NotInList_Exit
End Sub
Any help would be gratefully appriciated!
Thanks guys
Paul