mloucel
Member
- Local time
- Today, 13:43
- Joined
- Aug 5, 2020
- Messages
- 359
MODERATORS PLEASE:
I tried to attach my database but no matter how small, just the essentials, no data, Zipped and I still keep getting the same error message:
" The Uploaded File Is Too Large "
No zipped is: 14,336 kb
Zipped is: 9,130kb
Good [morning/afternoon/evening] wherever in the world you are.
I am working on a modification on a form my boss wants in our new software.
[This part WORKS fine]
The form is to ADD basic new patient information.
-Works by searching the input data, then:
-- If NOT found then ADD the Data to the Database
--- Requery the Subform
--- CleanUp the fields and return to the 1st one to start all over again
- IF FOUND [Here is my problem]
-- Should simply Requery the SUBFORM to display ONLY the record(s) that are found.
but instead of doing such it goes to BLANK
I tried to Upload the database but I keep getting an error [maybe I have my account restricted]
--- Check the section called:
'------------------------------------------------------------
' If record not found, add a new record
'
'------------------------------------------------------------
I enter details on where the issue is
The form has:
1 main form with 4 text fields
1 search button [ Private Sub SearchBtn_Click() ]
1 Reset Button
Please see in the code the NOTE that says:
' I am Having Issues Here ...
Here is my Code:
	
	
	
		
 I tried to attach my database but no matter how small, just the essentials, no data, Zipped and I still keep getting the same error message:
" The Uploaded File Is Too Large "
No zipped is: 14,336 kb
Zipped is: 9,130kb
Good [morning/afternoon/evening] wherever in the world you are.
I am working on a modification on a form my boss wants in our new software.
[This part WORKS fine]
The form is to ADD basic new patient information.
-Works by searching the input data, then:
-- If NOT found then ADD the Data to the Database
--- Requery the Subform
--- CleanUp the fields and return to the 1st one to start all over again
- IF FOUND [Here is my problem]
-- Should simply Requery the SUBFORM to display ONLY the record(s) that are found.
but instead of doing such it goes to BLANK
I tried to Upload the database but I keep getting an error [maybe I have my account restricted]
--- Check the section called:
'------------------------------------------------------------
' If record not found, add a new record
'
'------------------------------------------------------------
I enter details on where the issue is
The form has:
1 main form with 4 text fields
1 search button [ Private Sub SearchBtn_Click() ]
1 Reset Button
Please see in the code the NOTE that says:
' I am Having Issues Here ...
Here is my Code:
		Code:
	
	
	Option Compare Database
Option Explicit
Dim NR As Boolean
Dim UseButton As Boolean
'------------------------------------------------------------
' Form_Load
'
'------------------------------------------------------------
Private Sub Form_Load()
    DoCleanUp
End Sub
'------------------------------------------------------------
' PDOB_Click Patient's Date Of Birth call the new form
'
'------------------------------------------------------------
Private Sub PDOBTxt_Click()
    InputDateField PDOBTxt, "Select the DOB"
End Sub
'------------------------------------------------------------
' ResetBtn_Click Reset all the fields
'
'------------------------------------------------------------
Private Sub ResetBtn_Click()
    DoCleanUp
End Sub
'------------------------------------------------------------
' SearchBtn
'
'------------------------------------------------------------
Private Sub SearchBtn_Click()
    ' Check if ALL text boxes are filled with Data
    If Not DataValid(Me) Then
        Exit Sub
    End If
    
    Dim strSQL As String
    Dim rs As DAO.Recordset
    Dim Found As Boolean
    Dim RecordsFound As String
    
    ' Convert the first letter to Uppercase
    If Not IsNull(PLastNameTxt) Then PLastNameTxt = fnCapitalizeFirstLetter(PLastNameTxt)
    If Not IsNull(PFirstNameTxt) Then PFirstNameTxt = fnCapitalizeFirstLetter(PFirstNameTxt)
    
    ' Construct the SQL query
    strSQL = "SELECT * FROM PatientT " & _
             "WHERE PLastName = '" & Me.PLastNameTxt.Value & "' " & _
             "AND PFirstName = '" & Me.PFirstNameTxt.Value & "' " & _
             "AND PDOB = #" & Me.PDOBTxt.Value & "#;"
    'MsgBox strSQL
    
    ' Open a recordset based on the query
    Set rs = CurrentDb.OpenRecordset(strSQL)
    
    ' Check if any records are found
    If Not rs.EOF Then
        Found = True
        rs.MoveFirst
        Do Until rs.EOF
            RecordsFound = RecordsFound & "Name: " & rs!PLastName & " " & _
            rs!PFirstName & ", DOB: " & rs!PDOB & vbCrLf
            rs.MoveNext
        Loop
        rs.Close
        'MsgBox RecordsFound
    Else
    
        Found = False
    End If
    
'------------------------------------------------------------
' If record not found, add a new record
'
'------------------------------------------------------------
    If Not Found Then
    
        Set rs = CurrentDb.OpenRecordset("PatientT", dbOpenDynaset)
        rs.AddNew
        rs!PLastName = Me.PLastNameTxt.Value
        rs!PFirstName = Me.PFirstNameTxt.Value
        rs!PDOB = Me.PDOBTxt.Value
        rs!PPhone = PPhonetxt
        rs.Update
        rs.Close
        Me.FoundRecordsSF.Form.Requery
        
        MsgBox "Record added successfully!", vbInformation
        
        DoCleanUp
    Else
'------------------------------------------------------------
'
' I am Having Issues Here ...
'
'------------------------------------------------------------
        Found = True
        ' Assign the recordset to the subform's record source
        MsgBox strSQL
        Me.FoundRecordsSF.Form.RecordSource = strSQL
        ' Requery the subform to display the found records
        Me.FoundRecordsSF.Form.Requery
    End If
End Sub
'------------------------------------------------------------
' CleanUp routine
'
'------------------------------------------------------------
Sub DoCleanUp()
    PLastNameTxt = ""
    PFirstNameTxt = ""
    PDOBTxt = ""
    PPhonetxt = ""
    PLastNameTxt.SetFocus
    
End Sub 
	 
 
		 
 
		 
					
				 
						
					 I enjoy helping people so I hang out here and answer questions and give advice.  I also develop software for charities when I can and I even have a product that is sold to the public which I still upgrade occasionally to keep the customers happy and renewing every year.   The rest of the time I play Bridge although I hate airports so much that I no longer fly to events in other parts of the country the way I used to.  If I can't drive, I don't go.   What i just explained is a big picture concept which many don't actually see for years but it helps to put forms into perspective.
  I enjoy helping people so I hang out here and answer questions and give advice.  I also develop software for charities when I can and I even have a product that is sold to the public which I still upgrade occasionally to keep the customers happy and renewing every year.   The rest of the time I play Bridge although I hate airports so much that I no longer fly to events in other parts of the country the way I used to.  If I can't drive, I don't go.   What i just explained is a big picture concept which many don't actually see for years but it helps to put forms into perspective. "
 " 
 
		 
 
		 
 
		