General information
Category:
Forms & Form designer
>>Is it possible to select a dbf and then present it in a grid for presentation off data. When user nr 2 opens the form and the grid shows the dbf user nr 1s grid is blanked.
>>
>>Best regards
>>Per Simmersholm
>
>Add the grid to your form with the proper number of columns.
>Leave grid controlsource property and columns recordsource properties blank, then add the following line in the load event of the form :
>thisform.grid.controlsource = 'tablename'
This I have done.
But before I open the grid I run a query into a table.
so when user 2 use the same form/grid the same query is
run and then blanked.
Is it possible to select a random tablename and use this in the grid??
My code in the activate form start like this
SELECT *;
FROM hovedlønn;
INTO TABLE midhov1.dbf
SELECT midhov1
APPEND FROM korrdag
SELECT midhov1.ansnavn,midhov1.ansattnumm,midhov1.avdeling,midhov1.job,;
midhov1.dato1,midhov1.skift,midhov1.lønnsartna,;
midhov1.lønnsartnu,;
SUM(midhov1.Timer) AS Timer;
FROM midhov1;
GROUP BY midhov1.ansattnumm,midhov1.dato1,midhov1.avdeling,midhov1.job,midhov1.lønnsartnu;
ORDER BY midhov1.ansattnumm,midhov1.dato1,midhov1.avdeling,midhov1.job,midhov1.lønnsartnu;
INTO TABLE midhov.dbf
IF USED('prdag4')
SELECT prdag4
ELSE
USE prdag4.dbf
ENDIF
DELETE ALL
APPEND FROM midhov
PACK
SET ORDER TO ANSNAVN
GO TOP
IF THISFORM.ans.value="*"
THISFORM.Grid1.RecordSource='prdag4'
ELSE
THISFORM.Grid1.RecordSource='prdag3'
ENDIF
SELECT *;
FROM prdag4;
WHERE VAL(THISFORM.ans.value)=prdag4.ansattnumm;
INTO TABLE prdag3.dbf
THISFORM.Grid1.ColumnCount=9
THISFORM.Grid1.FontSize=8
THISFORM.Grid1.Column1.Width=180
THISFORM.Grid1.Column1.Header1.Caption="Ansatt"
THISFORM.Grid1.Column1.FontBold=.F.
THISFORM.Grid1.Column1.Enabled=.F.
THISFORM.Grid1.Column2.Width=30
THISFORM.Grid1.Column2.Header1.Caption="Nr"
THISFORM.Grid1.Column2.FontBold=.F.
THISFORM.Grid1.Column2.Enabled=.F.
THISFORM.Grid1.Column3.Width=30
THISFORM.Grid1.Column3.Header1.Caption="Avd"
THISFORM.Grid1.Column3.FontBold=.F.
THISFORM.Grid1.Column3.Enabled=.F.
THISFORM.Grid1.Column4.Width=30
THISFORM.Grid1.Column4.Header1.Caption="Job"
THISFORM.Grid1.Column4.FontBold=.F.
THISFORM.Grid1.Column4.Enabled=.F.
THISFORM.Grid1.Column5.Width=50
THISFORM.Grid1.Column5.Header1.Caption="Dato"
THISFORM.Grid1.Column5.FontBold=.F.
THISFORM.Grid1.Column5.Enabled=.F.
THISFORM.Grid1.Column6.Width=30
THISFORM.Grid1.Column6.Header1.Caption="Sk"
THISFORM.Grid1.Column6.FontBold=.F.
THISFORM.Grid1.Column6.Enabled=.F.
THISFORM.Grid1.Column7.Width=120
THISFORM.Grid1.Column7.Header1.Caption="Lønnsart"
THISFORM.Grid1.Column7.FontBold=.F.
THISFORM.Grid1.Column7.Enabled=.F.
THISFORM.Grid1.Column8.Width=30
THISFORM.Grid1.Column8.Header1.Caption="Nr"
THISFORM.Grid1.Column8.FontBold=.F.
THISFORM.Grid1.Column8.Enabled=.F.
THISFORM.Grid1.Column9.Width=42
THISFORM.Grid1.Column9.Header1.Caption="Timer"
THISFORM.Grid1.Column9.Text1.InputMask='99.99'
THISFORM.Grid1.ReadOnly=.F.
SET SAFETY ON
In the textbox interactivechange method I have the following code
SELECT *;
FROM prdag4;
WHERE VAL(THISFORM.ans.value)=prdag4.ansattnumm;
INTO TABLE prdag3.dbf
GO TOP
And then I run
THISFORM.Grid1.ColumnCount=9
THISFORM.Grid1.FontSize=8
THISFORM.Grid1.Column1.Width=180
THISFORM.Grid1.Column1.Header1.Caption="Ansatt"
etc...
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only