Object variable or With block variable not set: Runtime error 91

Solved
Adrien_35 Posted messages 3 Registration date   Status Membre Last intervention   -  
Adrien_35 Posted messages 3 Registration date   Status Membre Last intervention   -
Hello,

I have looked at the other responses regarding this issue, but as for me, I haven't declared any variables with. When I debug, it takes me back to the code of the module that opens my form.

I don't understand this error.

1 réponse

jordane45 Posted messages 30426 Registration date   Status Modérateur Last intervention   4 830
 
Hello,

As indicated in the message... this may concern a WITH block ... or an object

Object variable or With block variable


In any case.... without seeing your code.... no one will be able to help you!

NB: To post code on the forum, please do so using CODE TAGS (and specify the language to get syntax highlighting)
Explanations available here: https://codes-sources.commentcamarche.net/faq/11288-les-balises-de-code
.

NB²: Remember to test your code in STEP BY STEP mode to try to see on which line of code it generates the error...

--
Best regards,
Jordane
0
Adrien_35 Posted messages 3 Registration date   Status Membre Last intervention  
 
Module : (debugging brings me back here)
Sub openFormentry_new_request() F_Saisie_Request_new_Project.Show End Sub


Form:
Private Sub btn_cancel_Click() Me.cbo_project_name = "" Me.cbo_BU = "" Me.cbo_Country = "" Me.cbo_request = "" Me.txt_expctddate = "" Me.txt_demand_description = "" Me.cbo_contact = "" End Sub Private Sub btn_quit_Click() Unload Me End Sub Private Sub btn_Save_Click() 'We check that the controls have been properly filled If Len(Me.txt_demand_description) = 0 Then Me.LabelMSG = "Please describe the need" Me.txt_demand_description.SetFocus ElseIf Len(Me.cbo_project_name) = 0 Then Me.LabelMSG = "Please inform a project name" Me.cbo_project_name.SetFocus ElseIf Len(Me.cbo_BU) = 0 Then Me.LabelMSG = "Please indicate the BU" ElseIf Len(Me.cbo_Country) = 0 Then Me.LabelMSG = "Please Indicate the location" ElseIf Len(Me.cbo_request) = 0 Then Me.LabelMSG = "Please inform the type of request" ElseIf Len(Me.txt_expctddate) = 0 Then Me.LabelMSG = "Inform an expected date of delivery" ElseIf IsDate(txt_expctddate) = False Then Me.LabelMSG = "Inform a valid expected date" ElseIf txt_expctddate <> Format(txt_expctddate, "dd/mm/yyyy") Then Me.LabelMSG = "Inform with format dd/mm/yyyy" ElseIf CDate(txt_expctddate) < Date Then Me.LabelMSG = "Please inform a date in the future" ElseIf Len(Me.cbo_contact) = 0 Then Me.LabelMSG = "Please indicate a contact" Else 'If all fields are complete then we can save to the source 'We look for the next empty row in the source Feuil2.Activate Feuil2.Range("A1048576").End(xlUp).Offset(1, 0).Select 'We assign form data to the source ActiveCell.Offset(0, 0) = Me.cbo_project_name ActiveCell.Offset(0, 1) = Me.cbo_BU ActiveCell.Offset(0, 2) = Me.cbo_Country ActiveCell.Offset(0, 3) = Me.cbo_request ActiveCell.Offset(0, 4) = Me.txt_expctddate ActiveCell.Offset(0, 5) = Me.txt_demand_description ActiveCell.Offset(0, 6) = Me.cbo_contact ActiveCell.Offset(0, 7) = "To be processed" ActiveCell.Offset(0, 8) = ActiveCell.Offset(-1, 8).Value + 1 End If End Sub Private Sub UserForm_Initialize() F_Saisie_Request_new_Project.Show End Sub 
0
Adrien_35 Posted messages 3 Registration date   Status Membre Last intervention  
 
Okay, I had to delete the last sub: Userform initialize which echoed my module.

See you soon!
0