Pop Up Message

dzirkelb

Registered User.
Local time
Today, 04:41
Joined
Jan 14, 2005
Messages
180
I would like to display a pop-up message on a form when a specific field has been changed. I know how to add teh pop up message for that section; however, I would like the pop-up message to display data from a sql statement. Here is the sql:

select PurchSpecialHandling FROM InventoryMaster1 WHERE Part=(input from form)

I need to know what to place for the input from form, how to assign a variable to the result, and display the data. Thanks!
 
In the code behind the After Update event of the field, you can use DLookup, rather than the SQL as written. Hence,

Select PurchSpecialHandling FROM c WHERE Part=(input from form)

would become

variable name = DLookup("PurchSpecialHandling","InventoryMaster1","Part=" & (input from form))

Note: You would need to change this

"Part=" & (input from form))

to this.

Hope it helps.

"Part='" & (input from form) & "'")

if the Part is a string, rather than a number.
 
I get a variable not defined error when trying to do the code...here is what I have:

Code:
Dim PurchSpecialHandling
PurchSpecialHandling = DLookup("PurchSpecialHandling", "InventoryMaster1", "Part='" & PreRequisitionBuysMasterForm1.Part# & "'")

It points to PreRequisitionBuysMasterForm1 for the error
 
I figured out the code...thanks for pointing me in the right direction. Below is the code I used:

Code:
Dim PurchSpecialHandling As String
If IsNull(DLookup("PurchSpecialHandling", "InventoryMaster1", "[Part #]='" & (Forms!PreRequisitionBuysMasterForm1!Part) & "'")) Then
    PurchSpecialHandling = ""
Else
    PurchSpecialHandling = DLookup("PurchSpecialHandling", "InventoryMaster1", "[Part #]='" & (Forms!PreRequisitionBuysMasterForm1!Part) & "'")
    MsgBox (PurchSpecialHandling)
End If
 

Users who are viewing this thread

Back
Top Bottom