Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run Time Error 424 Object Required

Status
Not open for further replies.

Wray69

Technical User
Oct 1, 2002
299
US
Hello All,

I know this isnt a VB Forum but this is home so I will ask here first... Creating a user form, and I am still new to VB, here is my code;

Private Sub cmdCancel_Click()
Unload Me
End Sub

Private Sub cmdClearForm_Click()
Call UserForm_Initialize
End Sub

Private Sub cmdSubmit_Click()
ActiveWorkbook.Sheets("Credit Data Form").Activate
Range("A1").Select
Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True
ActiveCell.Value = txtClientID.Value
ActiveCell.Offset(0, 1) = txtName.Value
ActiveCell.Offset(0, 2) = txtAmount.Value
ActiveCell.Offset(0, 3) = txtDate.Value
ActiveCell.Offset(0, 4) = cdoAgentName.Value
ActiveCell.Offset(0, 5) = cboPer.Value
ActiveCell.Offset(0, 6) = txtNotes.Value
End If
Range("a1").Select
End Sub

Private Sub UserForm_Initialize()
txtClientID.Value = ""
txtName.Value = ""
txtAmount.Value = ""
txtDat.Value = ""
With cboAgentName
.AddItem "Cory"
.AddItem "Crystal"
.AddItem "Jesse"
.AddItem "Arion"
.AddItem "Trisha"
.AddItem "Nate"
.AddItem "Mark"
.AddItem "N/A"
End With
With cboPer
.AddItem "Michael"
.AddItem "Luis"
.AddItem "Ritchie"
End With
txtNotes.Value = ""
txtClientID.SetFocus
End Sub

I keep getting "Run Time Error 424 Object Required" when I try and run this. Im using Office 2002 SP2 on Windows XP Pro. Does anyone know where I am going wrong? As always any help is much appreciated.

Thanks,

Wray
 
what line are you getting the error on ??

Rgds, Geoff
[blue]Quantum materiae materietur marmota monax si marmota monax materiam possit materiari?[/blue]
Want the [red]best[/red] answers to your questions ? faq222-2244
 
Thats why Im having problems fixing it, its not giving me a line... I try and run the form, I get the error, click ok and it doesnt give me a specific line.... Is it possible that something in the properties of the form would cause the error?

Regards,

Wray
 
Dunno - doubt it
Object required normally means you are trying to reference something that needs to be explicitly referenced. The only thing I cna see that would need that may be Activecell

Try
With sheets("Credit data form")
.activecell.offset.....etc etc
end with

see if it makes a difference

Rgds, Geoff
[blue]Quantum materiae materietur marmota monax si marmota monax materiam possit materiari?[/blue]
Want the [red]best[/red] answers to your questions ? faq222-2244
 
Hi Wray,

You don't say when you get the error but it is probably due to a typo referencing a Control which doesn't exist on your Form and I would suggest txtDat near the top of the UserForm_Initialize routine should be txtDate as referenced in the cmdSubmit_Click routine.

When you get this kind of error which doesn't report a line, try setting a breakpoint on the first line of the procedure and stepping through the code. That way you will know which lines have worked successfully when the error happens.

Enjoy,
Tony
 
Tony, thanks for the clue on the breakpoints. I narrowed it down to these two lines, but I have no idea what is wrong with them.

Private Sub UserForm_Initialize()
txtClientID.Value = ""

Thanks again,

Wray
 
Thanks everyone for their help... I figured it out. I was going from and example and I didnt follow instuctions to well. txtClientID.Value I had name ClientID.value... feel kinda boneheaded but its a learning experiance...

Thanks again,

Wray
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top