|
8#
楼主 |
发表于 2020-1-1 20:19:25
|
只看该作者
7.整合了黄海的超强界面:实现方式很简单,就是引用黄海的开放平台,然后调用时写一个函数,同步更新菜单到黄海平台的相关菜单表中。代码如下:
Public Function hy_UpdateSysMenu(Optional blnUpdate As Boolean = True)
'==============================================================================================
'函数作用:同步平台菜单到黄海菜单中,独立使用原平台,只是把三个菜单表移植到本主文件中
'使用注意:使用黄海平台前需要先执行本函数同步菜单;另外首页菜单需要单独自行编辑
'==============================================================================================
On Error Resume Next
If blnUpdate = False Then Exit Function
Dim rstTemp As ADODB.Recordset
Dim strSql As String
Set rstTemp = New ADODB.Recordset
On Error GoTo 0
DoCmd.SetWarnings False
DoCmd.RunSQL "delete * from sysHyMenus where id<>1" '先清除菜单表中的项目,但排除首页菜单
DoCmd.RunSQL "INSERT INTO sysHyMenus(menuName,orderNo,menuEnabled) SELECT MenuTextLocal,ID,Enabled FROM SysLocalNavigationMenus WHERE Enabled<>0 and Allow<>0 and Len(ID)=2 and ID Not In ('97','98','99') ORDER BY ID" '把平台的菜单同步到黄海的菜单表中
DoCmd.RunSQL "Alter TABLE sysHyMenuButtons Alter COLUMN id COUNTER (100,1)" '设置sysHyMenuButtons自动编号从100开始,sysHyMenus因为存在关系则无法设置自动编号
strSql = "SELECT * from sysHyMenus ORDER BY orderNo"
rstTemp.Open strSql, CurrentProject.Connection, adOpenStatic, adLockOptimistic
Do While Not rstTemp.EOF '循环菜单表
DoCmd.RunSQL "INSERT INTO sysHyMenuButtons(menuID,buttonName,cmdArgs,imgFile,orderNo,buttonEnabled) SELECT " & rstTemp.Fields("ID") & ",trim(MenuTextLocal),Command,'defaultButton.gif',ID,Enabled FROM SysLocalNavigationMenus WHERE Allow<>0 AND left([ID],2)=" & rstTemp.Fields("orderNo") & " AND len([ID])>2 ORDER BY ID" '把平台的菜单同步到黄海的菜单表中
rstTemp.MoveNext
Loop
If rstTemp.State = adStateOpen Then rstTemp.Close
DoCmd.SetWarnings True
End Function |
|