I came up with this and it works but is there a cleaner way to do it?
If IsNull(DLookup("[IndexKey01Label]", "tblCabinets", "[CabinetID] = " & Forms!frmMainWindow![cmbCurrentECabinet])) Then
Me.lblIndexKey01Label.Visible = False
Else
Me.lblIndexKey01Label.Caption = DLookup("[IndexKey01Label]", "tblCabinets", "[CabinetID] = " & Forms!frmMainWindow![cmbCurrentECabinet])
Me.lblIndexKey01Label.Visible = True
Me.cboIndexKey01.Visible = True
Me.cboIndexKey01.RowSource = "SELECT tblFolders.FolderID, tblFolders.IndexKey01 FROM tblFolders " & _
" WHERE FolderID = " & Nz(Me.cmbCurrentEFolder) & _
" ORDER BY IndexKey01"
End If
Me.lblIndexKey01Label.Visible = False
Else
Me.lblIndexKey01Label.Caption = DLookup("[IndexKey01Label]", "tblCabinets", "[CabinetID] = " & Forms!frmMainWindow![cmbCurrentECabinet])
Me.lblIndexKey01Label.Visible = True
Me.cboIndexKey01.Visible = True
Me.cboIndexKey01.RowSource = "SELECT tblFolders.FolderID, tblFolders.IndexKey01 FROM tblFolders " & _
" WHERE FolderID = " & Nz(Me.cmbCurrentEFolder) & _
" ORDER BY IndexKey01"
End If
With Warm Regards,
Arthur D. Lorenzini
IT System Manager
Cheyenne River Housing Authority
Wk.(605)964-4265 Ext. 130
Fax (605)964-1070
"Valar Dohaeris"
On Tuesday, November 28, 2017 02:23:11 PM, Duane Hookom duanehookom@hotmail.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:
Art,
Is the control a label? If so, it doesn't have a value. You would need to set the caption property. Assuming the CabinetID is numeric:
Me.lblIndexKey01Label.Caption = DLookup("[IndexKey01Label]", "tblCabinets", "[CabinetID] = " & Me.cmbCurrentECabinet)
Duane Hookom
From: MS_Access_Professionals@yahoogroups.com <MS_Access_Professionals@yahoogroups.com> on behalf of dbalorenzini@yahoo.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com>
Sent: Tuesday, November 28, 2017 2:07 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] Re: Dlookup Compile Error
Sent: Tuesday, November 28, 2017 2:07 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] Re: Dlookup Compile Error
Yeah me. I figured out the syntax error but now I have another error:
Me.lblIndexKey01Label = DLookup("[IndexKey01Label]", "tblCabinets", "[CabinetID] = " & Me.cmbCurrentECabinet)
Object doesn't support this property or method.
The specific on the combo is:
Name: cmbCurrentECabinet
Record Source: SELECT tblCabinets.CabinetID, tblCabinets.CabinetName FROM tblCabinets;
Bound Colum 1
Column COunt: 2
Column Width: 0;1
__._,_.___
Posted by: Art Lorenzini <dbalorenzini@yahoo.com>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (5) |
Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.
.
__,_._,___
Tidak ada komentar:
Posting Komentar