am facing an error 'Run time error:424 Object required,
Private Sub Form_Load()iam highlighting the error in code below.

Private Sub cmdAddEntry_Click()
' add a new entry to our table.
    With DataEnvironment1.rsDataTable
        .AddNew
        !CodeNo = txtCodeNo
        !DealerName = txtDealerName
        !TruckNumber = txtTruckNumber
        !Quantity = txtQuantity
        !NetPrice = txtNetPrice
        !Commision = txtCommision
        !Rent = txtRent
        !Labour = txtLabour
        !ReturnExpense = txtReturnExpense
        !Expense2 = txtExpense2
        !StoreExpense = txtStoreExpense
        !PhoneExpense = txtPhoneExpense
        !Expemse3 = txtExpemse3
        !TotalExpense = txtTotalExpense
        !Total = txtTotal
        
        .Update
    End With
    
    ' requery the db and re-bind the data source to the data grid
    DataEnvironment1.rsDataTable.Requery
    Set DataGrid1.DataSource = DataEnvironment1
    Call Form_Resize
    
    ' clear the text fields once the new record is added
    txtCodeNo = ""
    txtDealerName = ""
  txtTruckNumber = ""
   txtQuantity = ""
    txtNetPrice
    txtCommision
    txtRent
    txtLabour
    txtReturnExpense
    txtExpense2
    txtStoreExpense
    txtPhoneExpense
    txtExpemse3
    txtTotalExpense
    txtTotal
    
    ' set the focus back to the CodeNo textbox
    txtCodeNo.SetFocus

End Sub

Private Sub cmdRemoveEntry_Click()
    ' remove the currently selected item from the database
    DataEnvironment1.rsDataTable.Delete adAffectCurrent

End Sub

Option Explicit
' couple'o global vars for size trackin'
Dim MinHeight As Long
Dim MinWidth As Long

Private Sub Form_Load()
  ' record the height and size of the window for reference
    MinHeight = Form1.Height  <...................................ERROR HERE..
    MinWidth = Form1.Width
    
    ' disable the add button
    cmdAddEntry.Enabled = False


End Sub

Private Sub Form_Resize()
  ' check to see if the form is getting too small (Note: this is just to avoid
    ' the math necessary to shrink all the textboxes, hahahaha!!)
    If MinHeight > Form1.Height Then
        Form1.Height = MinHeight
        Exit Sub
    ElseIf MinWidth > Form1.Width Then
        Form1.Width = MinWidth
        Exit Sub
    End If
    
    ' resize the flexgrid to fit nicely on the screen
    DataGrid1.Width = Form1.ScaleWidth
    DataGrid1.Height = Form1.ScaleHeight / 2

    ' resize the happy columns to look pretty (40% for each text column, 20% for Track)
    DataGrid1.Columns(0).Width = 0.4 * DataGrid1.Width
    DataGrid1.Columns(1).Width = DataGrid1.Columns(0).Width
    DataGrid1.Columns(2).Width = DataGrid1.Width - (DataGrid1.Columns(0).Width * 2) - 60

    ' reposition  and resize the frames on the screen to fit nicely (there was no
    ' science here, just did it by trial and error)
    fraAddEntry.Top = (Form1.ScaleHeight / 2) + 100
    fraAddEntry.Height = (Form1.ScaleHeight / 2) - 150
    fraAddEntry.Width = (Form1.ScaleWidth * 0.64)
    fraRemoveEntry.Height = (Form1.ScaleHeight / 2) - 150
    fraRemoveEntry.Top = (Form1.ScaleHeight / 2) + 100
    fraRemoveEntry.Width = (Form1.ScaleWidth * 0.36) - 100
    fraRemoveEntry.Left = fraAddEntry.Width + 100

End Sub


Private Sub txtCodeNo_Change(Index As Integer)
   ' here, just check to see if each text field has contents.  If they all have
    ' contents (ie, they're not empty) enable the "Add Entry" button.
    If txtCodeNo.Text <> "" And txtDealerName.Text <> "" And txtTruckNumber.Text <> "" And txtQuantity.Text <> "" And txtNetPrice.Text <> "" And txtCommision.Text <> "" And txtRent.Text <> "" And txtLabour.Text <> "" And txtReturnExpense.Text <> "" And txtExpense2.Text <> "" And txtStoreExpense.Text <> "" And txtPhoneExpense.Text <> "" And txtExpemse3.Text <> "" And txtTotalExpense.Text <> "" And txtTotal.Text <> "" Then
        cmdAddEntry.Enabled = True
    Else
        cmdAddEntry.Enabled = False
    End If
    End Sub

Private Sub txtCommision_Change(Index As Integer)
 ' just call theCodeNo change method because the code here would be
    ' exactly the same.
    Call txtCodeNo_Change
End Sub

Private Sub txtDealerName_Change(Index As Integer)
    ' just call theCodeNo change method because the code here would be
    ' exactly the same.
    Call txtCodeNo_Change
End Sub

End Sub

Private Sub txtExpemse3_Change(Index As Integer)
 ' just call theCodeNo change method because the code here would be
    ' exactly the same.
    Call txtCodeNo_Change
End Sub

Private Sub txtExpense2_Change(Index As Integer)
 ' just call theCodeNo change method because the code here would be
    ' exactly the same.
    Call txtCodeNo_Change
End Sub

Private Sub txtLabour_Change(Index As Integer)
 ' just call theCodeNo change method because the code here would be
    ' exactly the same.
    Call txtCodeNo_Change
End Sub

Private Sub txtNetPrice_Change(Index As Integer)
 ' just call theCodeNo change method because the code here would be
    ' exactly the same.
    Call txtCodeNo_Change
End Sub

Private Sub txtPhoneExpense_Change(Index As Integer)
 ' just call theCodeNo change method because the code here would be
    ' exactly the same.
    Call txtCodeNo_Change
End Sub

Private Sub txtQuantity_Change(Index As Integer)
 ' just call theCodeNo change method because the code here would be
    ' exactly the same.
    Call txtCodeNo_Change
End Sub

Private Sub txtRent_Change(Index As Integer)
 ' just call theCodeNo change method because the code here would be
    ' exactly the same.
    Call txtCodeNo_Change
End Sub

Private Sub txtReturnExpense_Change(Index As Integer)
 ' just call theCodeNo change method because the code here would be
    ' exactly the same.
    Call txtCodeNo_Change
End Sub

Private Sub txtStoreExpense_Change(Index As Integer)
 ' just call theCodeNo change method because the code here would be
    ' exactly the same.
    Call txtCodeNo_Change
End Sub

Private Sub txtTotal_Change()
 ' just call theCodeNo change method because the code here would be
    ' exactly the same.
    Call txtCodeNo_Change
End Sub

Private Sub txtTotalExpense_Change(Index As Integer)
 ' just call theCodeNo change method because the code here would be
    ' exactly the same.
    Call txtCodeNo_Change
End Sub

Private Sub txtTruckNumber_Change(Index As Integer)
 ' just call theCodeNo change method because the code here would be
    ' exactly the same.
    Call txtCodeNo_Change
End Sub

this code is working ok when i tried , and also that line is ok
can you attach your project file here that i can check that why its....

this code is working ok when i tried , and also that line is ok
can you attach your project file here that i can check that why its....

yes sure .here is a project

Hi,
You have accidentally renamed your form to a text box. Rename it back to Form1

You have two frames (Frame1 and Frame2) that you are calling fraAddEntry and fraRemoveEntry

The textboxes that you have placed on the form are all copies of each other (even though you renamed them).
You have two choices:
Specifically name the text box e.g.
' clear the text fields once the new record is added
txtCodeNo(0).Text = ""
txtDealerName(1).Text = ""
txtTruckNumber(2).Text = ""
etc....
Or delete the text boxes from the form and add them again, but choose not to have them as occurances of the original.

That should at least get you past the Form_Load event :)

Decided that my reply wasn't very clear, so I've changed the code a little.

Also, you should think about adding an 'Update' button

Yes feedwards is right you renamed you form from form1 to something other and also your frames u using in form bot fram have defferent name as in coding
here updated
any other help tell otherwise mark this thread as solved pleaes

@ Feed wards Thank you so much for the corrections,iwill add a search button and if i found any problem i will inform you ,
@trilok31 thank you for your help too.
God bless you all for helping others.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.