Entering data to form with NOT ON LIST and cascading combo boxes

pam0566

Registered User.
Local time
Today, 13:46
Joined
Jun 6, 2008
Messages
132
I have a 2007 Access DB, which i am developing and want to then import data from an existing db. i have a form [frmvehicles] that adds new cars, when a new Model [one not prev on list] is entered, the form will as you if you want to add it, then add it to the tblmakemodel, and go on to next field. this works great. the problem is when /after i import my new data.. that field stops working. I have a cbo that selects the make of the car, a cbo that selects the model of the car, and a cbo that selects the submodel. I orig developed the table for available vehicles (as opposed to cars to be taken off list.) off of a table. I need it to read off of a query for available vehicles only. I am not sure how i messed this up or how i can fix it... the file is too large to upload, I can email to someoen if they have an idea or want to see. hope someone can help me, i have 2 mos into this. i am attaching the old db, before anything was imported. I imported data to the tblmake model for the cbomodel and the tblsubmodel for the submodel data.. and neither of those effect the frm , everything works there.. so thats not the problem... everythin works until i import the 100k of vehicle records i have. any ideas? The sample i am uploading is only to show how those fields were working. this is before i imported any data to the tblmakemodel or tbl submodel.. file again is too large to import after i imported that data.. but those fields worked after that..
 

Attachments

Here is the last working copy. to get the size small enough, i had to delete tblemployee data, tblequip data (not relevent for this problem, the equipment was working for the individual cars, and some of the records from both Tblmakemodel and tblsubmodel. I left some records... but at least you can see how it was working.
 

Attachments

This is the code for not on list.. for the cbomodel. I changed the source data for the form to my query, and can select records on the list, but not any that arent on the list.

Private Sub cbomodel_NotInList(NewData As String, Response As Integer)
Response = MsgBox("[" & NewData & "] is not recognized in this database." & vbCrLf & vbCrLf & "Would you like to add it?", vbQuestion + vbYesNo, "Unrecognized Data")
If Response = vbYes Then
' DoCmd.OpenForm "frmMakeModel Subform", acNormal, , , acFormAdd, acDialog, _
' Me.cbomake.Column(0) & ";" & NewData
'-- Create a new Supplier record
Dim MySQL As String
MySQL = "Insert Into tblMakeModel(Model,MakeID) " & _
"Values(""" & NewData & """," & Me.cbomake.Column(0) & ")"
CurrentDb.Execute MySQL, dbFailOnError
Response = acDataErrAdded
Else
Response = acDataErrContinue
End If
End Sub
 

Users who are viewing this thread

Back
Top Bottom