Dear Group,
I have a main continuous form called "F_EquipSpecs" which has command button "History" to open a related form "F_History" showing a specific record based on the selection of in the main continuous form. I enter new record in the main form and through command button run append query to populate the foreign key (EquipmentID) in the related table "T_History". Other fields such as "Activity Description" in the related table "T_History" are blank at this stage.
What I want to achieve is that when I open the main form (F_EquipSpecs" and a particular record is selected and if the related table field say "activity" is blank, the command button should be greyed and on click should display message box "there is no data" and if there is data, the command button should be normal on open the F_History form specific to that equipmentID
I tried the following but is not working. Please help.
-----------------------------------
Private Sub cmdHistory_click ()
Dim stLinkCriteria As String
stDocName = "F_History"
stLinkCriteria = "[lookupEquipment]=" & "'" & Me![EquipmentID] & "'"
If IsNull([Forms]![F_History]![Activity]) = True Then
MsgBox "Sorry No History exists for the equipment", , "No Details"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit Sub
End If
If IsNull(Forms]![F_History]![Activity]) = False Then
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If
End Sub
----------------------------------
Regards,
kumar
Posted by: access_kri@yahoo.com
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (1) |
Tidak ada komentar:
Posting Komentar