Results 1 to 1 of 1
  1. #1
    Join Date
    Aug 2012

    Unanswered: How to use lookup values from a table as labels in a subform

    Hello, I am a novice when it comes to Access programming. I am trying to take a values set in a table (by Pt#) and use them on a new input form as a Field label.

    The current coding used on the Subform "On Current" event works , but I continue to get a type mismatch dialog box when swithching records.

    Private Sub Form_Current()
    Dim i As Integer
    Dim rs As ADODB.Recordset
    Set rs = New ADODB.Recordset
    rs.Open "SELECT * FROM TblInspSet_Values WHERE cboSPartNumID=" & Form_FrmIncoming_Insp.cboSPartNumID & ";", CurrentProject.Connection, adOpenStatic, adLockPessimistic
    For i = 1 To 8
    Me.Controls("strINSPdata" & i & "_Label").Caption = rs.Fields("strINSPV" & i)
    'following is suggestion for the ValidationRule property, not tested (produces source object errors)
    Me.Controls("strINSPdata" & i).ValidationRule = rs.Fields("field name prefix here" & i)
    End Sub

    Syntax for calling procedure of subform eludes me.

    Right now there is no error handling in the code. Help is greatly appreciated

    Last edited by MP BILL; 08-10-12 at 13:47.

Posting Permissions

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