By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,460 Members | 2,215 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,460 IT Pros & Developers. It's quick & easy.

More problems RE: 2003>2010... grrr

P: 365
Hello again,

Im still trying to iron out the bugs in my previous programs (without too much effort),

The following code doesnt appear to be working in the Access 2003 MDE file when used with the Access 2010 Runtime environment, can anyone spot why?

The code is used to populate a custom "Switchboard" type main menu, which shows the buttons based on logon data, problem is only one box is shown in the 2010 environment, erroneously, i cant find the reason for "this" box (works fine with Full Access 2010 installed BTW)

The tblGroup has a link to UserID and the rest of the fields are the button names, so that it should build the list on the fly...

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2. Dim rst As DAO.Recordset, DB As DAO.Database
  3. Dim tdf As TableDef, fld As Field, sqlField As String, ctl As Control
  4.     Set DB = CurrentDb
  5.     Set tdf = DB.TableDefs("tblGroup")
  6.         For Each fld In tdf.Fields
  7.             Select Case fld.Name
  8.                 Case "GroupID", "Title"
  9.                 Case Else
  10.                     sqlField = sqlField & " tblGroup." & fld.Name & ","
  11.                 End Select
  12.         Next
  13.             sqlField = Left(sqlField, (Len(sqlField) - 1))
  14.     Set rst = CurrentDb.OpenRecordset("SELECT " & sqlField & " " & _
  15.                                             "FROM tblGroup INNER JOIN tblSecurity ON tblGroup.GroupID = tblSecurity.Group " & _
  16.                                                 "WHERE (((tblSecurity.UserID)=" & LogUserID & ") AND ((tblSecurity.Dept)=" & LogDept & "));")
  17.     For Each ctl In Me.Controls
  18.         ctl.Visible = False
  19.     Next
  20.     For Each fld In rst.Fields
  21.         Call Buttons(fld.Name, fld.Value)
  22.     Next
  23.         Call Buttons("BarcScan", True)
  24.         Call Buttons("Logout", True)
  25.         Call Buttons("Site", True)
  26.         Call Buttons("ChangePass", True)
  27.         Call Buttons("Logout", True)
  28. End Sub
Expand|Select|Wrap|Line Numbers
  1. Function Buttons(Task As String, OnOff As Boolean)
  2. Select Case Task
  3.     Case "BarcScan"
  4.         Me.cmb1.Visible = OnOff
  5.         Me.cmb1.Caption = "&A. Barcode Scan"
  6.         Me.cmb1.OnClick = "=OptionLoad(1,1)"
  7. .......
Thanks for the help, as always
May 17 '12 #1
Share this Question
Share on Google+
1 Reply

P: 365

Another invalid reference issue... i had tried to to hard code it elsewhere to change the Excel reference (to decide which version to use) but gave up and decided to remove the excel code and the reference, but this code remained and re-referenced it, thats what ya get for coding overnight.
May 17 '12 #2

Post your reply

Sign in to post your reply or Sign up for a free account.