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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SWITCHBOARD PROBLEM 1

Status
Not open for further replies.

moes123

Technical User
Jun 4, 2010
14
TT
I have designed a simple database in access 2003, however on one user system it won't open, the error i get is: Private Sub Combo35_AfterUpdate()
Find the record that matches the control.
Dim rs As Object

After i close the error message module, i get "Error loading DLL.

Can anyone help!

Thanks.
 
How are ya moes123 . . .

Post he code as you have it for [blue]Private Sub Combo35_AfterUpdate()[/blue] ...

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Am cool my brother,
Just for starters, i build this database without writing any codes, i have no formal training on programming, therefore understanding these codes is a bit of a problem.

The code from the Form_Switchboard(Code)is:
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 = Application.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
' If there are no options for this Switchboard Page,
' display a message. Otherwise, fill the page with the items.
If (rs.EOF) Then
Me![OptionLabel1].Caption = "There are no items for this switchboard page"

N.B. The Line that reads: Set con = Application.CurrentProject.Connection" has the word Connection highlighted in Yellow

Thanks for assisting
Moes.


 
The problem is that there is a control that is missing on that one computer. Possibly the ADO.

Under Tools/Macro Click on the Visual Basic Editor. Once that opens under tools click on References. If any required controls are missing you'll see the word missing in front of it and that'll tell you what's wrong.
 
Code:
Set con = Application.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
' If there are no options for this Switchboard Page,
' display a message. Otherwise, fill the page with the items.
If (rs.EOF) Then
Me![OptionLabel1].Caption = "There are no items for this switchboard page"

I don't see where you Dim'ed your variables. You need to create them (Dim), then Instantiate (Set) them when you need them. Then after it's all done, clean them up by closing/deleting/emptying each one.

If you have PowerPoint installed, you can browse through this presentation I found on the web:

Note on page/slide 10, he says:
Code:
'declare conn to be a Connection -
Dim conn As ADODB.Connection
' make a connection object -
Set conn = New ADODB.Connection
' specify what kind of data provider it is  -
conn.Provider = "Microsoft.Jet.OLEDB.4.0"
' open the connection on one database -
conn.Open "c:/walter/ass21.mdb"
' declare a recordset -
Dim myTableRS As ADODB.Recordset
' make one - 
Set myTableRS = New ADODB.Recordset
' open it using a table in the database, and the connection
myTableRS.Open "myTable", conn, adOpenDynamic, adLockPessimistic

So, take that, and apply it to your situation..

Report back.
 
Thanks for your information,

I was able to get some info. recently from a microsoft support site, which i followed and was able to get a solution, this is what i did:

Solution 2: Replace the ADO code in the Switchboard form with DAO

Replace the following line of code
Set con = Application.CurrentProject.Connection
with:
Set con = CurrentDb
Replace the following line of code
rs.Open stSql, con, 1 ' 1 = adOpenKeyset
with:
Set rs = con.OpenRecordset(stSql)
Remove the following line of code:
Set rs = CreateObject("ADODB.Recordset")
Locate the HandleButtonClick() procedure, and make the same modifications that you just made to the FillOptions() procedure.
On the Debug menu, click Compile ProjectName.
Close and save the Switchboard form.
Convert the database to Access 97.
I converted to 2002-2003 format

On completion, the switchboard opened properly on all users pc including the one that it was not opening

Thank you all for your support, as a newcommer to VBA coding i appreciate every bit of info.

Moes.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top