report question

D

David

Hello,

I have a database with a product sku being the primary key. I have
several reports that show different results for certain product skus.
Right now I have the report ask the user to type in the product sku but
want it to be if the user types in a sku not pertaining to that report
to not open the report or let the user know that they opened the wrong
report for that sku.


example


product sku 00000 00000 to 55555 55555 would go with one report and
66666 66666 to 99999 99999 would go with another. If the user clicked
onto the first report and typed in 77777 77777 is there a way to bring
up the second report or let the user know that they typed in a sku out
of range?



Thanks,
David
 
A

Arvin Meyer

Use a custom form to type in the number. In the click event of a single
button, just have it open the correct report with telling them anything. Use
some cdode like this (aircode):

Sub cmdMyButton_Click (Cancel As Integer)
On Error GoTo Error_Handler

If Me.txtSKU < Val("66666 66666") Then
DoCmd.OpenReport "rptReport 1", , "SKU = '" & Me.txtSKU & "'
Else
DoCmd.OpenReport "rptReport 2", , "SKU = '" & Me.txtSKU & "'
End If

Exit_Here:
Exit Sub
Error_Handler:
MsgBox "You really screwed up this time", vbOKOnly, "Say FOOL!"
Resume Exit_Here
End Sub
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
D

David

Arvin

Thank you for you reply but I am a beginer when it comes to Access. Are
there keywords I can serch for that would describe a bit more of what
you are suggesting? I am sorry I relly don't know where to start.

Thanks,
David
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top