Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2015
    Posts
    1

    Unanswered: Combining check & comboboxes to save a record... Access 101 Help!

    Hi there, thanks for all the communal help thus far! Referencing this forum is a beautiful thing.


    I've designed a front-end in Access and am having trouble getting my VBA code to work... would very much appreciate any feedback or suggestions! I'm still pretty new to VB and could very well be missing some basic components for this use-case....


    Essentially my db is made up of 8 tables and then the relationship tables that join them. I want to build in the functionality that allows users to "attach" or relate entities in one table to others from a form.

    Option buttons point to the different entity tables and set the record source for the combo box to choose any given record.

    THE PROBLEM: my issue is trying to CREATE NEW record using all the info that users provide/choose(w/the comboboxes)

    The Debugger has identified this line to be an issue:

    Code:
     Set rs = db.OpenRecordset(BUS_APP_SERVER_REL)
    .. but my full code is below:

    Code:
      Private Sub Check259_Click()
        
        Dim BP4_BizApp As String
        BP4_BizApp = "SELECT [BUS_APPL_NAME],[BUS_APPL_ID] FROM [BUSINESS_APPLICATIONS] ORDER BY [BUS_APPL_NAME]"
        
        If Me.Check259 = True Then
             Me.Combo257.RowSource = BP4_BizApp
        End If
        
        End Sub
        
        Private Sub Check261_Click()
        Dim BP4_ITApp As String
        BP4_ITApp = "SELECT [IT_APPL_NAME],[IT_APPL_ID] FROM [IT_APPLICATIONS] ORDER BY [IT_APPL_NAME]"
         If Me.Check261 = -1 Then
                 Me.Combo257.RowSource = BP4_ITApp
                 End If
        End Sub
        Private Sub Check263_Click()
        Dim BP4_Tool As String
        BP4_Tool = "SELECT [TOOL_NAME],[TOOL_ID] FROM [TOOLS] ORDER BY [TOOL_NAME]"
               If Me.Check263 = -1 Then
                     Me.Combo257.RowSource = BP4_Tool
                     End If
        End Sub
        Private Sub Check_265_Click()
        Dim BP4_DB As String
        BP4_DB = "SELECT [DB_NAME],[DB_ID] FROM [Databases] ORDER BY [DB_NAME]"
            If Me.Check265 = -1 Then
                        Me.Combo257.RowSource = BP4_DB
                        End If
        End Sub
        
        
        Private Sub Command221_Click()
          Dim db As Database
          Dim rs As DAO.Recordset
          Dim SVR_ID As Variant
          Dim BizApp_ID  As Variant
          Dim ENV As Variant
          Dim COMM As String
          
        BizApp_ID = Me.Combo257.AfterUpdate
        SVR_ID = Me!SERVER_ID
        ENV = Me.Combo214.AfterUpdate
        COMM = Me!Text216
        
          Set dbVideoCollection = CurrentDb
          Set rs = db.OpenRecordset(BUS_APP_SERVER_REL)
          
          rs.AddNew
          rs(BUS_APPL_ID).Value = BizApp_ID
          rs("SERVER_ID").Value = SVR_ID
          rs("ENV_TYPE").Value = ENV
          rs("COMMENTS").Value = COMM
          rs.Update
        End Sub
    thanks for your time!
    Ryan

  2. #2
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    Not clear on everything, but if that's a table name it has to be in quotes:

    Set rs = db.OpenRecordset("BUS_APP_SERVER_REL")
    Paul

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •