Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2003
    Posts
    106

    Unanswered: Change Field Value from Code

    Hi Can anyone help please?

    I have the following code in place:

    Set dbs = CurrentDb
    strsql = "SELECT WalkpackLogTbl.Date, WalkpackLogTbl.User, WalkpackLogTbl.District, WalkpackLogTbl.Brand, WalkpackLogTbl.[Number of Prospects], WalkpackLogTbl.[TPSD] FROM WalkpackLogTbl WHERE (((WalkpackLogTbl.[TPSD])=No))"

    Set rst = dbs.OpenRecordset(strsql)

    myCount = 0

    Do While Not rst.EOF

    myWalkpack = Format(rst("District"), ">") & "_" & rst("Brand") & "_" & rst("User") & "_" & Format(rst("Date"), "dd_mm_yy") & "_TPS.xls"

    myDir = Dir("\\plytrn01\sales targeting\SME Data\Results\" & myWalkpack & "")

    If myDir = myWalkpack Then
    myCount = myCount + 1
    myResponse = MsgBox("Found File: " & myDir & " Would you like to format this walkpack now?", vbYesNo + vbQuestion, "SME Walkpack Creator - Sales Targeting©")

    If myResponse = vbYes Then

    End If
    End If
    rst.MoveNext
    Loop


    This code creates a filename from variuos fields on the WalkpackTbl Table and then searches for that filename in the above directory.

    If it finds the file, it opens a message box asking the user to format the file.

    What i would like to do is if the user chooses yes (if myResponse = vbYes) then the TPSD field on the WalkpackLogTbl Table relating to that record should be changed to YES or TRUE.

  2. #2
    Join Date
    Jul 2003
    Location
    Amsterdam, Nederland
    Posts
    450

    Lightbulb can this help you

    If myResponse = vbYes Then


    rst.edit
    rst.[TPSD])="YES"
    rst.update


    end if

  3. #3
    Join Date
    Aug 2003
    Posts
    106

    Change Field Value from Code

    Thanks again Marvels!

    Dan

Posting Permissions

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