A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Calling Control Info from Table



 
 
Thread Tools Display Modes
  #1  
Old September 9th, 2006, 06:09 PM posted to microsoft.public.access.forms
Alan
external usenet poster
 
Posts: 459
Default Calling Control Info from Table

Not sure I have the title right here, but here goes
Thanks to an earlier post I now have my Form with many buttons beautifully
coloured etc. However as I update the information the data on screen becomes
dated ... I have toyed with the idea of storing information about Control
Objects in a table alongside the SQL that provides the value and have written
a small if loop to attempt to marshal this function however am clearly going
somewhere wrong

Dim rstData As Recordset
Dim CtrlSource As Control
Dim Executable As String

strSQL = "SELECT * FROM tblControlSQL WHERE
(((tblControlSQL.DATASET)='Employee'))"
Set rstData = CurrentDb.OpenRecordset(strSQL, dbOpenDynaset)

While rstData.EOF = False
With rstData
Set CtrlSource = .Fields("Name")
Executable = .Fields("ExecutableSQL")
CtrlSource = CountRows(Executable)
.MoveNext

End With
Wend

I had hoped this would update all buttons and text boxed called from the
SELECT statement viz Forms!btnParttime.Caption = *the result of the SQL
associated in the table
Maybe Im way of the mark here .. Can anyone tell me if this is possible or
where i should look for an alternative

Many Thanks

  #2  
Old September 9th, 2006, 08:27 PM posted to microsoft.public.access.forms
Barry Gilbert
external usenet poster
 
Posts: 379
Default Calling Control Info from Table

One thing that pops out is your CtrSource variable. You have it dimmed as a
control, but your trying to set it with a string. Try:

Set CtrlSource = Me.Controls(.Fields("Name"))
Then, I'm not sure what your CountRows function does, but I think you want
to populate the control's controlSource from the table. If so, this might
work:
CtrlSource.COntrolSource = .Fields("ExecutableSQL")

Barry

"Alan" wrote:

Not sure I have the title right here, but here goes
Thanks to an earlier post I now have my Form with many buttons beautifully
coloured etc. However as I update the information the data on screen becomes
dated ... I have toyed with the idea of storing information about Control
Objects in a table alongside the SQL that provides the value and have written
a small if loop to attempt to marshal this function however am clearly going
somewhere wrong

Dim rstData As Recordset
Dim CtrlSource As Control
Dim Executable As String

strSQL = "SELECT * FROM tblControlSQL WHERE
(((tblControlSQL.DATASET)='Employee'))"
Set rstData = CurrentDb.OpenRecordset(strSQL, dbOpenDynaset)

While rstData.EOF = False
With rstData
Set CtrlSource = .Fields("Name")
Executable = .Fields("ExecutableSQL")
CtrlSource = CountRows(Executable)
.MoveNext

End With
Wend

I had hoped this would update all buttons and text boxed called from the
SELECT statement viz Forms!btnParttime.Caption = *the result of the SQL
associated in the table
Maybe Im way of the mark here .. Can anyone tell me if this is possible or
where i should look for an alternative

Many Thanks

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:10 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.