Results 1 to 1 of 1

Thread: Query question

  1. #1
    Join Date
    Sep 2005

    Unanswered: Query question

    I have an application that allows a user to click a button which then opens up a temp table into which the user can paste data from a spreadsheet.

    I need to make sure that the data they enter is "their" data and not for someone else. That is, they login as planner XYZ and then the mess up and paste data for planner ABC. I need to check to make sure the pasted data has plannercode = 'XYZ'.

    How can I do this?

    Private Sub ValidatePlannerEnteredData()
    On Error GoTo Err_ERROR

    planner = Forms!frm_Main!txtPlannerCode
    Dim strSQL As String

    ' the purpose of this subroutine is to make sure that if the planner has entered data for Stock Classes,
    ' Dealer Supplier Codes, Alternate Dealer Supplier Codes, or Part Numbers, that the planner codes listed
    ' in the temp tables are the same as the planner they are logged in as. For example, if they are logged in
    ' as planner M01 and they paste records for planner M15, we need to throw an error and not allow this.

    ' Run check for Stock Class table
    If fExistTable(planner & "_temp_stockclass") Then

    strSQL = "SELECT DISTINCT PLANNERCODE FROM " & planner & "_temp_stockclass"

    CurrentDb.Execute strSQL

    End If

    Exit_sub: ' Label to resume after error.
    Exit Sub ' Exit before error handler.

    Err_ERROR: ' Label to jump to on error.
    Call LogError(Err.Number, Err.Description, "Sub ValidatePlannerEnteredData()", Me.Name)
    Resume Exit_sub

    End Sub
    Last edited by ssmith001; 07-26-06 at 14:16.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts