G
Guest
I currently have a form that can have up to 96 pieces of data entered
independently. I have made a few macros that will copy the data from one
text box and paste it into several other text boxes on the form (so I don't
have to enter the same data multiple times). The problem is I may want to
copy/paste more than one text box when pushing the command button (because I
do not want to many buttons on the screen...for simplicity). I wrote code
using IF..Then statements so multiple macros can run off a single button.
This all works good...except the copy/paste only works correctly if the data
in the text box is numerical. If I run the macros independent of the button
(if..then statement) it works fine with numerical or text data.
An example of my if..then statement is as follows:
Private Sub Ctl6_sample_Click()
On Error GoTo Err_Ctl6_sample_Click
Dim stDocName As String
If Text9.Value = True Then
stDocName = "6-sam 1"
DoCmd.RunMacro stDocName
Else
Text9.Value = Null
End If
If Text17.Value = True Then
stDocName = "6-sam 2"
DoCmd.RunMacro stDocName
Else
Text17.Value = Null
End If
and so on until all macros are accounted for.
Not all text boxes will have data in them, thus I only want the macro to run
if there is data in the originating text box (from which the macro copies).
Any idea as to why it will only copy numerical data when using the above
code...when it will copy/paste text if the macro is run independent of code?
Thank you
independently. I have made a few macros that will copy the data from one
text box and paste it into several other text boxes on the form (so I don't
have to enter the same data multiple times). The problem is I may want to
copy/paste more than one text box when pushing the command button (because I
do not want to many buttons on the screen...for simplicity). I wrote code
using IF..Then statements so multiple macros can run off a single button.
This all works good...except the copy/paste only works correctly if the data
in the text box is numerical. If I run the macros independent of the button
(if..then statement) it works fine with numerical or text data.
An example of my if..then statement is as follows:
Private Sub Ctl6_sample_Click()
On Error GoTo Err_Ctl6_sample_Click
Dim stDocName As String
If Text9.Value = True Then
stDocName = "6-sam 1"
DoCmd.RunMacro stDocName
Else
Text9.Value = Null
End If
If Text17.Value = True Then
stDocName = "6-sam 2"
DoCmd.RunMacro stDocName
Else
Text17.Value = Null
End If
and so on until all macros are accounted for.
Not all text boxes will have data in them, thus I only want the macro to run
if there is data in the originating text box (from which the macro copies).
Any idea as to why it will only copy numerical data when using the above
code...when it will copy/paste text if the macro is run independent of code?
Thank you