After Event Scan (1 Viewer)

HeelNGville

Registered User.
Local time
Today, 05:23
Joined
Apr 13, 2004
Messages
71
Help with scanning and sound.

By utilizing the search feature, I have discovered issues that are somewhat relative to what I need assistance with, however nothing specific. So here we go…

1. I have a table named tblManifest. Within this table is a text field named PRODUCT and a text field named ACTION (which is a YES or NO option). There are multiple records (duplicates are acceptable) stored within this table/field
2. I have a form named frmReceipts. Within this form is a text box named PRODUCT.
Here is my issue. Within frmReceipts & text box PRODUCT, the user will utilize a handeld scanner to scan a product id barcode. After the scan, I want the record to be added to a table named tblReceipts. This is I have.

My problem is with product identity and specialized treatment of specific product id’s. What I need is when the user scans the product id and that particular product id is flagged as YES within the ACTION field in tblManifest, I would like for a separate wav file to be played and a comment box to flash on the screen. This will alert the user that the product requires specialized treatment. The wav is located in C:\My Documents\Test.wav. If product is flagged as NO, then no wav should be played and no comment is displayed.

I would imagine that this is possible, however beyond my basic Access skills. Thanks in advance for any assistance.
 
Last edited:

HeelNGville

Registered User.
Local time
Today, 05:23
Joined
Apr 13, 2004
Messages
71
RG,
thanks for the information, however I need some assistance with the code to arrive at the point of playing sound. Once the scan occurs, a piece of code should run that looks for the value 'YES' (based on product id) in tblManifest and if that is present, then the wav file is played and a msg box is displayed.

Any ideas?
 

RuralGuy

AWF VIP
Local time
Today, 04:23
Joined
Jul 2, 2005
Messages
13,826
Put the following code in the AfterUpdate event of the PRODUCT textbox.
Code:
If DLookup("[ACTION]", "tblManifest", "[PRODUCT] = '" & Me.Product & "'") = True Then
   PlaySound ("C:\My Documents\Test.wav")
   MsgBox "Specialized treatment is required!"
End If
Post back if you need more assistance. I'll be glad to help. What version of Windows and Access are you running?
 

HeelNGville

Registered User.
Local time
Today, 05:23
Joined
Apr 13, 2004
Messages
71
RG,

Attempted to utilize code, however receive compile error after event update. I have created a sample DB that contains the basic info similiar to what I currently use. Currently utilizing Windows 2K Professional and Office/Access 2K.

Thanks for the assist.
 

Attachments

  • Test DB.zip
    12.5 KB · Views: 99

RuralGuy

AWF VIP
Local time
Today, 04:23
Joined
Jul 2, 2005
Messages
13,826
You haven't put Allen Browne's PlaySound code in a module yet.
 

RuralGuy

AWF VIP
Local time
Today, 04:23
Joined
Jul 2, 2005
Messages
13,826
You also need to change the table name:
Code:
Private Sub PRODUCT_AfterUpdate()
If DLookup("[ACTION]", "[b]tblManifestData[/b]", "[PRODUCT] = '" & Me.PRODUCT & "'") = True Then
   PlaySound "C:\Good.wav"
   MsgBox "Specialized treatment is required!"
End If
End Sub
And you need to change the Action field to a Yes/No field in the table. You have it as a Text field in the demo. You may also want to move the code to the OnExit or LostFocus event so it will check every time you leave the control and not *just* when the control is changed.
 

RuralGuy

AWF VIP
Local time
Today, 04:23
Joined
Jul 2, 2005
Messages
13,826
I have attached the revised mdb along with a sound file and moved the code so it will sound off every time you leave the control. It also looks for the sound file in the same directory as the mdb.
 

Attachments

  • Test1.zip
    148.8 KB · Views: 139

RuralGuy

AWF VIP
Local time
Today, 04:23
Joined
Jul 2, 2005
Messages
13,826
You're certainly welcome and thanks for posting back.
 

Users who are viewing this thread

Top Bottom