theinviter
Registered User.
- Local time
- Today, 14:58
- Joined
- Aug 14, 2014
- Messages
- 255
Dear Guys;
i need your help,
I have a form name navigation panel and show the total number of record in field Text0 and Text12.
so i want on click of button it copy the value of specified field above (Text0 and Text12) in Statistics Table .
i tried the code below but it work if there is a subform in the main form.
so please guide me how to do this on button click copy the record in new record in Statistics Table.
Code Tags Added by UG
Please use Code Tags when posting VBA Code
Please read this for further information:-
Please feel free to Remove this Comment
i need your help,
I have a form name navigation panel and show the total number of record in field Text0 and Text12.
so i want on click of button it copy the value of specified field above (Text0 and Text12) in Statistics Table .
i tried the code below but it work if there is a subform in the main form.
so please guide me how to do this on button click copy the record in new record in Statistics Table.
Code:
Private Sub Command28_Click()
Dim bolWithBlank As Boolean
Dim bm As Variant
On Error GoTo new_Err
Me![Table1 subform].Form.RecordsetClone
If Not (.BOF And .EOF) Then
.MoveFirst
Do While Not .EOF
If Len(Trim(!Prep.Value & "")) = 0 Then
bolWithBlank = True
bm = .Bookmark
Exit Do
End If
.MoveNext
Loop
If bolWithBlank Then
.Bookmark = bm
.Edit
Else
.AddNew
End If
!Prep = Me.Text0.Value
!Prep1 = Me.Text12.Value
'!Record_ID = Me.ID_Drug.Value
.Update
Else
.AddNew
!Prep = Me.Text0.Value
!Prep1 = Me.Text12.Value
'!Record_ID = Me.ID_Drug.Value
.Update
End If
End With
new_Err:
MsgBox "Updated"
End Sub
Code Tags Added by UG
Please use Code Tags when posting VBA Code
Please read this for further information:-
Please use Code Tags when posting VBA Code
To make your code easier to read, please use the Code tag around your code, this will ensure that any code you copy and paste from your DB retains it's formatting making it easier to read and follow; Firstly click on the Code button, that's the button at the top of the posting window with the...
www.access-programmers.co.uk
Last edited by a moderator: