Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dim conn As ADODB.Connection
- Dim rs As ADODB.Recordset
- Private Sub Form_Load()
- Set conn = New ADODB.Connection
- conn.Open CurrentProject.Connection
- Set rs = New ADODB.Recordset
- With rs
- rs.CursorLocation = adUseClient
- rs.Open "select * from amsPor", conn, adOpenStatic, adLockBatchOptimistic
- Set rs.ActiveConnection = Nothing
- End With
- Set Me.Recordset = rs
- conn.Close
- End Sub
- Private Sub Form_Unload(Cancel As Integer)
- Select Case MsgBox("Save changes ?", vbQuestion + vbYesNoCancel)
- Case vbNo
- 'do nothing
- Case vbYes
- conn.Open CurrentProject.Connection
- rs.ActiveConnection = conn
- rs.UpdateBatch
- rs.Close
- Set conn = Nothing
- Case vbCancel
- Cancel = True
- End Select
- End Sub
- Sub Randomise
- Randomize
- Set rs = CreateObject("ADODB.Recordset")
- With rs
- .Fields.Append "RandomNumber", 4
- .Fields.Append "Txt", 201, 5000
- .Open
- Do Until Inp.AtEndOfStream
- .AddNew
- .Fields("RandomNumber").value = Rnd() * 10000
- .Fields("Txt").value = Inp.readline
- .UpDate
- Loop
- .Sort = "RandomNumber"
- Do While not .EOF
- Outp.writeline .Fields("Txt").Value
- .MoveNext
- Loop
- End With
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement