help required for Cascading Combobox

gots

Registered User.
Local time
Tomorrow, 03:55
Joined
May 2, 2008
Messages
20
Hi friends,

I want to make cascading combos for my tables as below on the form "Customer Details"

tbl_Zone
ZoneID
Zone Name

tbl_City
CityID
CityName

tbl_State
StateID
StateName

tbl_Country
CountryID
CountryName

tbl_CustomerDetails
Zone Name
...
...
...
Address
City Name
State Name
Post Code
Country Name
...
...
...

I want to also set onnotinlist for the combos to accept the data entry.

Thanks in advance.

-Gautam
 
Attached is an example of cascading combos and the following is a code example of not in list:


Private Sub cboStanPhrase_NotInList(NewData As String, Response As Integer)

'Displays message for not in list event and asks if user wants to add to selection
'sets group level to corresponding selection

Dim db As DAO.Database
Dim newrec As DAO.Recordset
Dim strMsg As String

strMsg = "'" & NewData & "' is not in list" & vbCrLf & vbCrLf
strMsg = strMsg & "Do you want to add this standard phrase to list?"
strMsg = strMsg & vbCrLf & vbCrLf & "Click Yes to add or No to re-type it."

If MsgBox(strMsg, vbQuestion + vbYesNo, "Add new standard phrase to list?") = vbNo Then
Response = acDataErrContinue
Else
Set db = CurrentDb
Set newrec = db.OpenRecordset("tblStanPhrase", dbOpenDynaset)
On Error Resume Next
newrec.AddNew
newrec!StanPharsetxt = NewData
newrec.Update

If err Then
MsgBox "An error occurred. Please try again."
Response = acDataErrContinue
Else
Response = acDataErrAdded
End If

End If

Set newrec = Nothing
Set db = Nothing

End Sub

Hope it helps and good luck John :)
 

Attachments

Dear John,

Thank you for the help. I will study and learn.

Regards,

Gautam Patel
 

Users who are viewing this thread

Back
Top Bottom