PDA

View Full Version : Run time error in MS Access



Diogenes
23-07-2008, 05:17 PM
I have an access database, with a switchboard (created using the 'Switchboard Manager').

The dbase is used by several staff throughout our office, and has work fine for last few years.

Now, one of the staff has had their PC replaced, and the whenever they try to open the switchboard form, they get a run time error '430'.

My first thought was that there was something funny with my code. BUT, I created a blank dbase, and ran the switchboard manager to create a new switchboard, and the same thing happens.

Code snippet:
Private Sub FillOptions()
' Fill in the options for this switchboard page.
' The number of buttons on the form.
Const conNumButtons = 8
Dim con As ADODB.Connection
Dim rs As ADODB.Recordset
Dim stSql As String
Dim intOption As Integer
' Set the focus to the first button on the form,
' and then hide all of the buttons on the form
' but the first. You can't hide the field with the focus.
Me![Option1].SetFocus
For intOption = 2 To conNumButtons
Me("Option" & intOption).Visible = False
Me("OptionLabel" & intOption).Visible = False
Next intOption
' Open the table of Switchboard Items, and find
' the first item for this Switchboard Page.
Set con = CurrentProject.Connection
stSql = "SELECT * FROM [Switchboard Items]"
stSql = stSql & " WHERE [ItemNumber] > 0 AND [SwitchboardID]=" & Me![SwitchboardID]
stSql = stSql & " ORDER BY [ItemNumber];"
Set rs = CreateObject("ADODB.Recordset")
rs.Open stSql, con, 1 ' 1 = adOpenKeyset

The problem lies with Set con = CurrentProject.Connection

I have googled galore, but found no answers, so please help......

Jen
23-07-2008, 06:38 PM
Are they using a different version of Access to the rest?

Diogenes
24-07-2008, 10:47 AM
No... All using the same version...

Parry
24-07-2008, 08:23 PM
Mmm not sure. Ive had problems with the switchboard manager between versions, even though its code created by MS but your saying the versions are the same. Presumably this also means service packs - check the build as well. Your using a reference to ADO so presumably theres a reference on the machine concerned but I think you cant even compile if the reference isn't there so thats probably not the problem. Try and compact and repair the database or Set con = CurrentDb.Connection and see if this fixes it.

hth,
Graham

odyssey
25-07-2008, 01:36 PM
One thing that you may like to check is what References are installed in VB and the order.

To check this, first go to a machine where the database works, open up visual basic (Alt+F11) and then select tools-> references from the menu. Note down reference are ticked and the order. Close the database and move to the machine with the problem. Open the database and then go to the references dialog box as before. Check to see if the same references are ticked and in the same order. If they are the same for both then this is not the problem. However, if not, then find the missing reference from the list and select it. You should also use the priority buttons if necessary to make sure that they are in the same order. Once you have made the changes, then close the references dialog box and exit VB. Then try your switchboard and see if that makes a difference.

Note if you do have a missing reference, then once you have found it, the easiest way to get it to the top of the list is to select it and then click on the ok button. Then reopen the refences dialog box and it should be a the bottom of the ticked list of references You can then use the priority buttons to shift the references up as necessary.

HTH
Dave