• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Error 91 Object Variable or With block variable not set

Steve DeWeese

New Member
I have a simple user form to enter details on projects. It is modified from another database that is working fine but I must have broken something when changing for this application. Can anyone help identify where this is breaking down?

Thank you,

Steve
 

Attachments

  • Project Tracking.xlsm
    246.8 KB · Views: 2
HI Steve,

Care to tell us what button/macro is being run when the code breaks? You've got a large form with many parts, as well as a separate code module in your project.
 
Taking a wildshot, line 184 in the form looks suspsicious to me:
Code:
Me.Reg3.Value = Me.Reg2.Value + " " + Me.Reg1.Value

With the space in the middle, it looks like you're building a string, but you can't add strings. Perhaps this should be:
Code:
Me.Reg3.Value = Me.Reg2.Value & " " & Me.Reg1.Value
 
I need to pull that part out...that was to combine first & last name in the other version of this...

I get the error when I use the form to look up one of the projects. The lookup function works fine, loading the records into the list window but when I double click on the intended choice, I get the error. It should populate the form with that record so that it can be edited or deleted.

Thank you,

Steve
 
I pulled that part of the code out of this file but the error is still occurring...
 

Attachments

  • Project Tracking.xlsm
    246.3 KB · Views: 1
Have you by any chance, modified this workbook on a different machine and then returned it to your current PC?

I ask because we've been seeing odd failures from using Excel with different updates applied .... there's a relatively easy fix for it,, but it bewildered us for a while :confused:
 
Hi:

Please find the attached. I have fixed it.

Thanks
 

Attachments

  • Project Tracking.xlsm
    239.6 KB · Views: 6
Hi:

Your look button is basically the find function in excel, The coding in your workbook uses wildcard to search for project names , that code was executing great hence you where able to see the project names in the list box. You were getting the error while trying to click on one of the names displayed to get the details. This was because it was referencing to a wrong column (Column 1 instead of column 3). I didn't do anything fancy just change the number 1 to 3.

Thanks
 
Thank you, that is very helpful and now I see what that code was saying....the only thing I'm having an issue with now is the edit feature. I am trying to Have the ability to add or change information in the form and then update that record in the database. Right now, information that I add to an existing record in the project form does not save to the database. The "Add to Database" button is disabled when editing and the edit button does not write out the new information to the database. I tried enabling the "Add" button but then it is trying to create a new record and tells me the record I am updating already exists. Ideally, I would like the changes to be saved to the record when either the edit button is clicked, or I could add another button for save / update. All of your help is greatly appreciated.

Thank you,

Steve
 
Hi:

Please find the attached the edit will update the following
fields
Reg3
Reg5
Reg6
Reg7
Reg8
Reg9
Reg10
Reg11
Reg12
Reg13
Reg14
Reg15
Reg16
Reg17
Reg18

Thanks
 

Attachments

  • Project Tracking.xlsm
    241.3 KB · Views: 5
Back
Top