borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (run DTS package from VB app)Next Topic (data reports) New Topic New Poll Post Reply
AndreaVB Forum : Database : log file + Compare function in Access
Poster Message
Amiga2000
Level: Professor

Registered: 31-10-2002
Posts: 77

icon log file + Compare function in Access

i want to create a log file containing the following information:

ProjectID User Time FieldsUpdated

22, John, 9-jan-03 5:30 pm, description telephone meetingDate

By selecting a project from the ListBox a frmUpdate will be opened. There i can make changes. Once i press the save button it has to check if certain fields are changed. So i need the compare function as well. Anyone know
what that function is called?

The log info are saved to a logTable.

And i want to know what the best way to make this log.

Tia
John

09-01-2003 at 09:14 AM
View Profile Send Email to User Show All Posts | Quote Reply
JLRodgers
Level: Moderator

Registered: 04-04-2002
Posts: 1617
icon Re: log file + Compare function in Access

This post should be in the "Database" category.

If you're wanting to compare different fields on the forms (with the forms open), you can just reference them (IE: frmUpdate.TextA.text=frmOriginal.TextA.text) Otherwise you'll have to store the values into a global variable.

Not sure what you mean by compare function.

You'd access the log table the same way as other tables, store data whenever you want the log made.



____________________________
Everywhere's Local (classifieds, job postings, & more for everycity in the world - user entered)

09-01-2003 at 02:30 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
Amiga2000
Level: Professor

Registered: 31-10-2002
Posts: 77
icon Re: Re: log file + Compare function in Access

i want to compare value in the database with the txtfield. if someone made changes in that textfield it has to compare with the old value.

First i retrieve all data from a project
then assign each data to a var.

Set rsFill = dbData.OpenRecordset(strSql, dbOpenDynaset)
  With rsFill
    If Not .BOF And Not .EOF Then
      txtEmail = !Email
      OldEmail = !Email
      txtDescription = !Description
      OldDescription = !Description
      txtAmount = !Amount
      OldAmount = !Amount

Now if someone wants to change description the txtDescription is changed. So i want to compare what's in the textfield with the old value.
If it's not the same then it has to save to log
containing the field which has been updated.

i want to compare between oldDescription and txtDescription.

[Edited by Amiga2000 on 09-01-2003 at 05:34 PM GMT]

09-01-2003 at 04:02 PM
View Profile Send Email to User Show All Posts | Quote Reply
JLRodgers
Level: Moderator

Registered: 04-04-2002
Posts: 1617
icon Re: log file + Compare function in Access

Whereever the code is that stores the changes (ex: update/save button). You just add lines to store the info you want into another table.


'    with adc being the connection
' If you want leading/trailing spaces to be stored
' Otherwise use Trim() around both variable & Textbox
' Of course if you want different cases (IE: a->A different needing log)
' then you can use (for a built in function):
'     StrComp(String1, String2, CompareMethod)
    If OldEmail <> txtEmail.Text Or OldDescription <> txtDescription.Text Or OldAmount <> txtAmount.Text Then
        arsLog.Open "LogTable",adc, adOpenDynamic, adLockOptimistic
    ' Store whatever fields you want here into the log
    End If


____________________________
Everywhere's Local (classifieds, job postings, & more for everycity in the world - user entered)

09-01-2003 at 08:54 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
AndreaVB Forum : Database : log file + Compare function in Access
Previous Topic (run DTS package from VB app)Next Topic (data reports) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder