News, links, downloads, tips and tricks on Microsoft Access and related

About Me Search
Name:Alex Dybenko

Location:Moscow, Russia

Thursday, March 31, 2011

How to redraw Access form on RDC session

I recently moved one of my applications to terminal services hosting. In most case this works just fine, but in this application I use DBPix ActiveX control with pop-up form (red ring) over it, movable by user:


This combination produced very weird visual effects on terminal server session, basically control area was not repainted correctly. I tried to send WM_PAINT message, InvalidateRect function, nothing helped. So I ended up with following solution: after form load and after event of moving popup form I run .Move form method to move form one pixel left and then back.

If IsRunningInTerminal() Then
       Me.Move Me.WindowLeft + 8
       Me.Move Me.WindowLeft – 8
End If

Not very elegant solution, but it works. And if you know better solution – please post comment here.

By the way, Ammara developing new DBpix 3.0 version with some exciting features!

Labels: ,

Tuesday, March 29, 2011

Cascaded Combos on Datasheets

Most of us use Cascaded Combo boxes on normal form, idea is straight-forward, but is does not work on continuous or datasheet form. Here a database from A.D. Tejpal, Access MVP, with sample form showing how to make Cascaded Combos on Datasheets. The trick is to make combo box bound to visible field of lookup table, so data for all records will be shown in spite of combo box recordsource, and manage combo box updating  in VBA code.

Scenario I used this approach – you assign users to projects, some users are gone,  and you want to see them on old projects, but in combo box list you want to see actual users only.

Labels: ,

Thursday, March 24, 2011

Is your Application Running under Terminal Services?

Below VBA code to check this, IsRunningInTerminal() function returns True when you Access application runs in Terminal server session:

Private Declare Function GetSystemMetrics _
Lib "user32" (ByVal nIndex As Long) As Long

Public Const SM_REMOTESESSION As Long = &H1000

Function IsRunningInTerminal() As Boolean
   IsRunningInTerminal = _
      (GetSystemMetrics(SM_REMOTESESSION) <> 0)
End Function

Labels: , ,

Thursday, March 17, 2011

MDE Compiler

Relax! There is no way to compile mdb or mde to exe, the way VB6 do. Imagine what your antivirus think about exe file which always get changed? This MDE Compiler is simply exe wrapper around MDE, which looks like executable, with its custom icon, version, file properties, but in reality it just unpack mde file and run it with preinstalled Access or Access runtime. The only case where it ca be useful – is to fool IT department, and sell them Access application (they all does not like Access!) as executable.