Runtime error 91

tails

Board Regular
Joined
Jan 30, 2005
Messages
130
I'm using a mixture between access and visual basic to create a program, that allows users to enter data into a visual basic program and it sends the data through that program into an access database and then onto another program that the it administration can look at to see what needs to be done and what requests we have from users.

It works on both my computer and the other administrators computer but when i try to open it from a users computer it comes up with a run time error 91 object variable or With block variable not set.

The whole program works, we have tryed it between the two admin computers and it works perfectly except for the runtime error when i open the program from any other computer.

i have pinpointed it to the line of code that adds a new column to the database when the program first opens.
- adodc1.recordset.addnew
it is creating a new line in the access database so users can enter the data, does anyone know how to fix it.
if anyone knows that would be great.
thanks...
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
You may have a missing reference on the machine with the error, especially if the code runs OK on your machine.
Try going to any module, selecting Tools | References, and scanning for any missing references. If you find one, select the reference from the huge list and check the box.
IF you don't see a missing reference, go the machine where the code works and see which references are checked. Now look in the machine where the code fails, and make sure that they match EXACTLY. That should fix it.


Denis
 
Upvote 0
thanks, i'll go try that. but im not sure if it would be because of the users access to the database itself or their access to he drive its on.

(y)
cheers
 
Upvote 0
Also the other computers on the network dont have visual basic installed onto them. I couldn't see why they would need visual basic installed onto them because i have made the program into a .exe file so that other computers can run it without needing visual basic installed onto them. plus if visual basic is installed onto the computers themselves then users will have access to the coding which is something i cant allow them to do...
 
Upvote 0
Hi Tails,

Not sure what else to suggest without seeing the code in its context. would you be able to post the routine here? As for the run-time error, I still think it's likely to be a reference issue.

Denis
 
Upvote 0
here is the code that i am using for the program, its not much but its just what i need to make it work


Private Sub cmdend_Click()
End
End Sub

Private Sub cmdsend_Click()
MsgBox ("Thank you for using IT Assistance")
End
End Sub

Private Sub Form_Load()
Adodc1.Recordset.AddNew
Adodc1.Visible = False
txtID.Text = ""
txtDate.Text = ""
txtTime.Text = ""
txtlocation.Text = ""
txtDescription.Text = ""
Adodc1.Visible = False
Combo1.AddItem "1"
Combo1.AddItem "2"
Combo1.AddItem "3"

End Sub

Private Sub mnuabout_Click()
frmuser.Visible = False
Form2.Show
End Sub

Private Sub mnuend_Click()
End
End Sub

i have also linked the text boxes on the form to the database itself so that as soon as data is entered into them, it is sent straight to the database. so it is being updated while the users are entering data into it. there is also a datagrid settled on the form as well. it is not visible to the users when the program is operational but i know that the data is constantly updated because when i make it visible for my own use so i can check to make sure its working. it puts the data in the datagrid withour any errors.
 
Upvote 0
forgot to add
under the
Private Sub Form_Load()
it is this line that causes the error
Adodc1.Recordset.AddNew
 
Upvote 0
Hmmm...

Haven't encountered Adodc1 as a library before -- I bet that's what causes the problem in Access. Is this part of the VB installation? Normally references to ADO in Access and Excel are ADODB.something or other. If you can't find refs to Adodc1 in the Tools | References area, you may need to install it. But ... shouldn't the EXE compile with all required libraries?
Sorry, currently out of my comfort zone on this one.

Denis
 
Upvote 0

Forum statistics

Threads
1,213,495
Messages
6,113,992
Members
448,538
Latest member
alex78

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top