Flex Grid Control in Access

P

Peter Hibbs

I am trying to use a Flex Grid Active X control on an Access 2K form and I
want to be able to edit the text in a cell. The normal method suggested by
Microsoft is to create a text box and move it on top of the cell, enter the
text and then update the Flex Grid on exit.

The problem is that the text box control is always hidden UNDERNEATH the
Flex Grid control (regardless of the Bring-to-Front settings, etc). I have
tried the same thing in VB6 and the system works correctly but in Access is
doesn't, I suppose there must be something different about an Access form.

Does anyone know if it is possible to do this in Access.
 
D

Douglas J. Steele

You're correct that there are differences between forms in Access and VB.
There isn't a Bring-to-front capability in Access. Try setting focus on the
text box instead.
 
P

Peter Hibbs

Sorry Douglas, tried that. The strange thing is the cursor changes to the I
shape when I click on the cell but the text does not appear, presumably it is
being entered into the text box underneath.
 
P

Peter Hibbs

Douglas.

I don't think the code is too relevant but here it is anyway. If you
definitely did this in Access I would be very interested to see it. Is it
possible, maybe, in later versions of Access?

Private Sub flxgrd_EnterCell()

'txtCell is a Text box
'flxgrd is the FlexGrid control

txtCell.Left = flxgrd.CellLeft + flxgrd.Left
txtCell.Top = flxgrd.CellTop + flxgrd.Top
txtCell.Height = flxgrd.CellHeight
txtCell.Width = flxgrd.CellWidth
txtCell.SetFocus

End Sub

This problem can be demonstrated very easily with no code required, just
create a form, copy a flex grid and a text box control to the form and make
the text box partially overlap the flex grid control. The text box will
always be under the flex grid (if it isn't then I'm doing something very
wrong).

William.
Looked at the code you pointed out but could not see anything to cover this
situation(although there is an awful lot of code so I may have missed
something), maybe it is not possible.

Any more thoughts anyone.
 
W

William Hindman

....but a frame control can set on top of a flexgrid in an access form ...so
you insert a textbox inside a frame with no borders ...a generic code sample
is here:
http://lists.topica.com/lists/VB6Helper/read/message.html?sort=d&mid=812017202William Hindman"Douglas J. Steele" <NOSPAM_djsteele@NOSPAM_canada.com> wrote in messageI'm sure I've done this successfully. What does your VBA code look like?>> --> Doug Steele, Microsoft Access MVP> http://I.Am/DougSteele> (no private e-mails, please)>>> "Peter Hibbs" <[email protected]_SPAM> wrote in messageSorry Douglas, tried that. The strange thing is the cursor changes to theI>> shape when I click on the cell but the text does not appear, presumablyit is>> being entered into the text box underneath.>> -->> Peter Hibbs>>>>>> "Douglas J. Steele" wrote:>>>>> You're correct that there are differences between forms in Access andVB.>>> There isn't a Bring-to-front capability in Access. Try setting focus onthe>>> text box instead.>>>>>> -->>> Doug Steele, Microsoft Access MVP>>> http://I.Am/DougSteele>>> (no private e-mails, please)>>>>>>>>> "Peter Hibbs" <[email protected]_SPAM> wrote in message>>> >I am trying to use a Flex Grid Active X control on an Access 2K formand I>>> > want to be able to edit the text in a cell. The normal methodsuggested by>>> > Microsoft is to create a text box and move it on top of the cell,enter>>> > the>>> > text and then update the Flex Grid on exit.>>> >>>> > The problem is that the text box control is always hidden UNDERNEATHthe>>> > Flex Grid control (regardless of the Bring-to-Front settings, etc). Ihave>>> > tried the same thing in VB6 and the system works correctly but inAccess>>> > is>>> > doesn't, I suppose there must be something different about an Accessform.>>> >>>> > Does anyone know if it is possible to do this in Access.>>> > -->>> > Peter Hibbs>>>>>>>>>>>
 
P

Peter Hibbs

William.
Using a Frame control did sit above the Flex Grid in Design mode, however,
when running the code it drops back underneath. Also same for Rectangle and
Picture controls. I looked at the Web Site you mentioned but I think that was
referring to forms in Excel which are different to Access maybe. I haven't
tried this in Excel.

Albert.
Yes there are other alternatives I can use but I would like to use a Flex
Grid, if possible. Maybe it's now time for Plan B.
 
M

mtermoul

In my case I just wanted to put an image on top of the grid saying "Loading,
please wait..." however I couldn't position the image on top of the flexgrid
no matter what until I found out about the subforms.
So to solve the issue I've put my image in a subform and put the subform on
top of the flexgrid and it works, since Access is saying that subforms and
list boxes will always be on top of other controls no matter what!

I hope that this is helpful.
 
P

Peter Hibbs

Hi mtermoul

Yes, extremely helpful. I have designed a technique to edit cells using your
idea and it works pretty well. The only small problem is that when editing
the text in a cell the sub-form has the focus instead of the main form so one
has to be careful with placing code in the Activate and Deactivate events
although this should not be a major problem. I plan to publish a demo
database using the Flex Grid on the Internet in the near future.

Anyway, thanks again.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top