Decipher more code (1 Viewer)

Thedon123

Registered User.
Local time
Today, 22:16
Joined
Sep 11, 2002
Messages
98
I am very dunb when it comes to vb so i would appreciate this code being deciphered. i am gussing it takes a value and adds it somewhere.


Option Compare Database

Private Sub SelectSRO_Click()
Dim SRO As String
Dim currentRec As Long

[Form_Add Claim].FLT_CODE_FLT_CODE_ID = Me!SearchComp.Value
[Form_Add Claim].refresh_descriptions
'[Form_Add Claim].PostFaultCode_AfterUpdate
'[Form_Add Claim].VFaultCode_AfterUpdate
'[Form_Add Claim].CamFaultCode_AfterUpdate
'[Form_Add Claim].PFaultCode_AfterUpdate
'[Form_Add Claim].PartFaultCode_AfterUpdate

currentRec = [Form_Add Claim].CurrentRecord

DoCmd.Close acForm, "FC_Search_Add"

DoCmd.GoToRecord , , acGoTo, currentRec
End Sub
Private Sub Close_Click()
On Error GoTo Err_Close_Click


DoCmd.Close

Exit_Close_Click:
Exit Sub

Err_Close_Click:
MsgBox Err.DESCRIPTION
Resume Exit_Close_Click

End Sub
 

pono1

Registered User.
Local time
Today, 14:16
Joined
Jun 23, 2002
Messages
1,186
The code says this:

"Meet at the third ticket office at Paddington Station at 22:30, as agreed. Bring two quail eggs, a large hammer, a dead cat, and a pint. Never mind with the swan's head, the brass goblet, and the shoes.

Your loving wife,
Margaret"

It is, after all, code.

Regards,
Tim
 

pono1

Registered User.
Local time
Today, 14:16
Joined
Jun 23, 2002
Messages
1,186
T,

Now for the real, if not mildly dull, answer:

Effectively, the code attempts to synchronize two forms, moving to the same record number in one form that is the current record in another. It also copies a value in a control on one form to a control on another.

Yet there are loose ends here -- as though it's a work in progress... A bit of a mystery...

Below is line-by-line deciphering...

Code:
'When something named selectSRO is clicked...
Private Sub SelectSRO_Click() 

'Create two variables in memory to temporarily hold data
Dim SRO As String 'yet this variable is not used below... 
Dim currentRec As Long 

'Copy the value from a control named SearchComp on the 
'current form (me) to a control named FLT_CODE_FLT_CODE_ID 
'on a form named Form_Add Claim 
[Form_Add Claim].FLT_CODE_FLT_CODE_ID = Me!SearchComp.Value 


'this I don't understand...a control on a form 
'but nothing is done with it...
[Form_Add Claim].refresh_descriptions 

'All the lines below are inactive by virtue of the 
'apostrophe that precedes them
'[Form_Add Claim].PostFaultCode_AfterUpdate 
'[Form_Add Claim].VFaultCode_AfterUpdate 
'[Form_Add Claim].CamFaultCode_AfterUpdate 
'[Form_Add Claim].PFaultCode_AfterUpdate 
'[Form_Add Claim].PartFaultCode_AfterUpdate 

'Assign the current record number from Form_Add Claim
'to one of our variables.
'The current record number is the record number displayed
'at the bottom of the screen between the navigation buttons.
currentRec = [Form_Add Claim].CurrentRecord 

'close a form named FC_Search_Add
DoCmd.Close acForm, "FC_Search_Add" 

'in our active form, move to a record that matches 
'the current rec in Form_Add Claim
DoCmd.GoToRecord , , acGoTo, currentRec 

End Sub 'done

'another click event sub procedure
Private Sub Close_Click() 

'if there's an error, move directly down 
' to the line that says "Err_Close_Click:" and
'run the code there
On Error GoTo Err_Close_Click 

'close the current form
DoCmd.Close 

'leave this section of code
Exit_Close_Click: 
Exit Sub 

'this code runs if there's an error
'looks like regular wizard inserted stuff
Err_Close_Click: 
MsgBox Err.DESCRIPTION 
Resume Exit_Close_Click 

End Sub
Regards,
Tim
 
Last edited:

Users who are viewing this thread

Top Bottom