Textbox1 visible only.

Sherrise

New Member
Joined
Oct 25, 2021
Messages
18
Office Version
  1. 365
Platform
  1. Windows
I have 1 data entry form with three buttons. Button 1-New Page, 2-Clear New Book, 3-Exit back to spreadsheet. The form has a book name and how many pages of the book at the top, then question. There is a page number field and other fields that I fill out for any pages that I find a error on.

Once you have entered all the information on the first page that you find a error on, you fill out the question and click new page. It transfers the information to my spreadsheet. My coding clears all fields but Textbox 1 (Book Name & Textbox 2 (Number of page in the book). I want textbox1 & textbox2 to be visible only on the form and not transfer again just the answers to the questions.

My coding works except that the Textbox1 (Book Name) & Textbox2 (Page Count) gets transferred o my spreadsheet for each page. I do not want it to do this. HELP Please.

Texbox1 (Book Name)
Textbox2 (Page Count0


Page Number?
If errors how many?
What error was found?
What kind of error?
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Hi,
it would be very helpful if you could share the code you are having issues with - plenty here to assist you

Dave
 
Upvote 0
Hi,
it would be very helpful if you could share the code you are having issues with - plenty here to assist you

Dave
Will do. I used the example in my message because it was to complicated to explain what I am doing. Let me see if I can explain. I look at medical records and remove (black out/redact) items that can not be seen by unauthorized individuals and I need to keep track of what I have redact or what pages I have removed. This is my coding for the New Page and form.

Private Sub cmbNewPage_Click()
Dim wks As Worksheet
Dim AddNew As Range
Dim x As Integer
Dim strCode As String
Dim strtext As String
Dim strh As String
Dim inti As Integer
Dim rownumber As LoadPictureConstants
Dim sht As Worksheet
Set wks = Sheets("Exemption Log")

Set AddNew = wks.Range("A65356").End(xlUp).Offset(1, 0)


'The button will transfer the information to the spread sheet and open the Page Form.

Worksheets("Exemption Log").Cells(3, 2).Value = TxtCaseNumber.Text
Worksheets("Exemption Log").Cells(5, 2).Value = TxtRespondentName.Text

AddNew.Offset(0, 0).Value = FolderNameTxt.Text

AddNew.Offset(0, 1).Value = DocUnderMainFileTxt.Text
AddNew.Offset(0, 2).Value = OrigNumberPagesTxt.Text
AddNew.Offset(0, 4).Value = HeldAttyWorkProduct.Text
AddNew.Offset(0, 5).Value = PageNumberRedaction.Text
AddNew.Offset(0, 9).Value = TxtNotes.Text

AddNew.Offset(0, 3).Value = HeldOrigPg.Text


'Clearing data fields of userform


PageNumberRedaction.Value = ""
HeldOrigPg.Value = ""
HeldAttyWorkProduct.Value = ""
HeldRCM.Value = ""



Dim z As Integer

Set sht = Sheets("exemption log")
rownumber = 15
''sace H and I

'On Error Resume Next
On Error GoTo errhandler
For x = 1 To 7
If x = 1 Then
strCode = "R"
ElseIf x = 2 Then
strCode = "P"
ElseIf x = 3 Then
strCode = "PC"
ElseIf x = 4 Then
strCode = "C"
ElseIf x = 5 Then
strCode = "O"
ElseIf x = 6 Then
strCode = "RC"
ElseIf x = 7 Then
strCode = "A"
End If

For z = 1 To 13

If z = 1 Then
strtext = "Name"
ElseIf z = 2 Then
strtext = "Address"
ElseIf z = 3 Then
strtext = "Phone"
ElseIf z = 4 Then
strtext = "Cell"
ElseIf z = 5 Then
strtext = "SSN"
ElseIf z = 6 Then
strtext = "dOB"
ElseIf z = 7 Then
strtext = "Email"
ElseIf z = 8 Then
strtext = "DEA"
ElseIf z = 9 Then
strtext = "NPI"
ElseIf z = 10 Then
strtext = "MedicalInfo"
ElseIf z = 11 Then
strtext = "MentalHealth"
ElseIf z = 12 Then
strtext = "Opinion"
ElseIf z = 13 Then
strtext = "Product"


End If


If txtboxexists("txt_" & strCode & "_" & strtext, Me) = True Then
If FrmDataEntry("txt_" & strCode & "_" & strtext) <> vbNullString Then
strh = strh & "/" & FrmDataEntry("txt_" & strCode & "_" & strtext) & " " & strCode & "-" & strtext
inti = inti + CInt(FrmDataEntry("txt_" & strCode & "_" & strtext))
End If
Else
' MsgBox "txt_" & strCode & "_" & strtext
End If
nextz:
Next z
Next x


If Len(strh) > 0 Then
strh = Mid(strh, 2)
End If
AddNew.Offset(0, 7).Value = strh
AddNew.Offset(0, 8) = inti


For x = 1 To 7
If x = 1 Then
strCode = "R"
ElseIf x = 2 Then
strCode = "P"
ElseIf x = 3 Then
strCode = "PC"
ElseIf x = 4 Then
strCode = "C"
ElseIf x = 5 Then
strCode = "O"
ElseIf x = 6 Then
strCode = "RC"
ElseIf x = 7 Then
strCode = "A"
End If
For z = 1 To 13
If z = 1 Then
strtext = "Name"
ElseIf z = 2 Then
strtext = "Address"
ElseIf z = 3 Then
strtext = "Phone"
ElseIf z = 4 Then
strtext = "Cell"
ElseIf z = 5 Then
strtext = "SSN"
ElseIf z = 6 Then
strtext = "dOB"
ElseIf z = 7 Then
strtext = "Email"
ElseIf z = 8 Then
strtext = "DEA"
ElseIf z = 9 Then
strtext = "NPI"
ElseIf z = 10 Then
strtext = "MedicalInfo"
ElseIf z = 11 Then
strtext = "MentalHealth"
ElseIf z = 12 Then
strtext = "Opinion"

ElseIf z = 13 Then
strtext = "Product"

End If

If txtboxexists("txt_" & strCode & "_" & strtext, Me) = True Then

If FrmDataEntry("txt_" & strCode & "_" & strtext) <> vbNullString Then

FrmDataEntry("txt_" & strCode & "_" & strtext) = ""

End If
End If
Next z
Next x

Exit Sub
errhandler:
If Err.Number = -2147024809 Then
GoTo nextz:
End If
MsgBox Err.Number & Err.Description


TxtCaseNumber.SetFocus



End Sub
1680536901775.png
 
Upvote 0

Forum statistics

Threads
1,215,134
Messages
6,123,237
Members
449,093
Latest member
Vincent Khandagale

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top