Combo Problem

Ste4en

Registered User.
Local time
Today, 03:46
Joined
Sep 19, 2001
Messages
142
I made (with help from this forum archive) a cascading combo box form, it all works fine except when I first select on the first combo_Group1; I get a message box "Enter parameter Value" - Group1, I leave it blank and select Ok and everything works fine, until I reopen the form. Sometimes immediately after OK I get "runtime error 2001" and when I debug it highlights this line

Me!SfrmUpdate.LinkMasterFields = "Group1"

I do not see any difference in my query to the example I found, Can anyone sport the problem. Let me know if I need to post the rest of the form vba Thanks



Code:
Private Sub Form_Open(Cancel As Integer)

    Dim strSQL As String
    
    strSQL = " SELECT DISTINCT tblData.Group1 FROM tblData ORDER BY tblData.Group1;"
    ComboGroup1.RowSource = strSQL
    
End Sub
__________________________________________

Private Sub ComboGroup1_AfterUpdate()

     Dim strSQL As String
     Dim strSQLSF As String
          
     ComboGroup2 = Null
     ComboGroup3 = Null
     
     strSQL = "SELECT DISTINCT tblData.Group2 FROM tblData "
     strSQL = strSQL & " WHERE tblData.Group1 = '" & ComboGroup1 & "'"
     strSQL = strSQL & " ORDER BY tblData.Group2;"
     
     ComboGroup2.RowSource = strSQL
               
     strSQLSF = "SELECT * FROM tblData "
     strSQLSF = strSQLSF & " WHERE tblData.Group1 = '" & ComboGroup1 & "'"
               
     Me!SfrmUpdate.LinkChildFields = "Group1"
     Me!SfrmUpdate.LinkMasterFields = "Group1"
    
     Me.RecordSource = strSQLSF
     Me.Requery
          
End Sub
 
I have attached a small part of the database which might help. Please have a look.
thanks
 

Attachments

Users who are viewing this thread

Back
Top Bottom