PDA

View Full Version : [SOLVED:] how to assign a value to the Table of back-end thru VBA code



lrnathantrc
11-02-2007, 03:37 AM
Hi friends,

I want to replace the selected record thru SQL from a table after doing all the comparisons etc., with "Yes" to a Verified field. How can I do that thru VBA code. so that I can replace:banghead: the existing value"No" with "Yes".

Thanks in advance.
bye
LRN

asingh
11-03-2007, 01:16 AM
Hi,

Please explain your table structure...and what field you want to compare too..??....And what field needs to be changed...more details...are needed.

regards,

lrnathantrc
11-04-2007, 10:30 PM
I am using two forms one for data entry and another for data verification

Two forms with a table of same fields with a primary key(GNumber)


- on lost focus event of a primary key field
A subroutine is called for comparison of each field with the entered field in the second form.
after comparing the last Record-Id I am informing the operator what are the errors found out.
after the corrections made I am saving the record in the verified file. For which record I have to make the verified field as "Yes" with the exiting "No"



Private Sub LostFocus_GNumber()
code for comparison of fields (275-fields)
Code for going back to the fields for corrections(Wrong entry made)
after corrections
DoCmd.Save
DoCmd.AddRecord
GNumber.SetFocus
End sub

asingh
11-05-2007, 03:30 AM
Hi,

Create a field using the "yes/no" data type on the table that needs to be inspected for accuracy. Once the record has been verified, you can run a simple update query which will change the NO to a YES.

DarkSprout
11-05-2007, 08:35 AM
You could make (if you wish) the boolean field to be hidden (Visible = True)
run your code...

code for comparison of fields (275-fields)
If Successful = True Then

DarkSprout
11-05-2007, 08:43 AM
You could make (if you wish) the boolean field to be hidden on your form...([boolComparisonSuccess].Visible = False)
run your code ...code for comparison of fields (275-fields)...


If Successful = True Then
Me.boolComparisonSuccess = True
End If


Or, In a Module


Public Function ComparisonOfFields() as Boolean
On Error GoTo FunctionFail
...code for comparison of fields (275-fields)
ComparisonOfFields = True
Exit Function
FunctionFail:
ComparisonOfFields = False
End Function


Then in your form:=


Me.boolComparisonSuccess = ComparisonOfFields()

lrnathantrc
11-08-2007, 09:41 PM
Dear Friends,

I had solved the problem. Thanks verymuch for your valuable reply.

with regards
L.Ranganathan

lrnathantrc
01-31-2008, 10:01 PM
thanks members for your kind help
bye
LRN