PC Review


Reply
Thread Tools Rate Thread

How to bound field to control during runtime?

 
 
bruce
Guest
Posts: n/a
 
      3rd Sep 2006
Hi, all:
I have a subform, which RecordSource property is set by VBA. And
then, I want to bound one of recordset's field to a control, but It
sounds wrongly. Here is my code:

lngProblemID = Parent.GetProblemID
strSqlOptions = "SELECT Options.OptID, Options.ProbID,
Options.OptNote, Options.IsRight FROM Options"
strSqlOptions = strSqlOptions & " Where Options.ProbID = " &
lngProblemID
Me.RecordSource = strSqlOptions
Me.Requery


'Add new option record
Set recOptions = Me.Recordset
recOptions.AddNew
recOptions.Fields("ProbID") = lngProblemID


'set action property
With Me!bfrOption1
.ControlSource = "OptNote"
.Requery
.Class = "Word.Document"
.OLETypeAllowed = acOLEEmbedded
.Action = acOLECreateEmbed
End With


"OptNote" is one of Recordset's field,which is ole type. After I did
this, I can edit word in control normally, control's value is allright
indeed, but the recOptions.Fields("Prob") allways holding at Null.
What's the trouble with? Could I do it just like this way. If something

wrong, please wise me up! Thank you.

 
Reply With Quote
 
 
 
 
Brendan Reynolds
Guest
Posts: n/a
 
      4th Sep 2006
<quote>
strSqlOptions = "SELECT Options.OptID, Options.ProbID,
Options.OptNote, Options.IsRight FROM Options"
</quote>

<quote>
indeed, but the recOptions.Fields("Prob") allways holding at Null.
</quote>

Your SQL statement selects fields named 'OptID', 'ProbID', 'OptNote', and
'IsRight'. It does not select any field named 'Prob'. Possibly that might
have been a typo in the newsgroup post, but if not, if you're trying to do
anything via your form with a field named 'Prob', you'll need to include
that field in the SELECT clause of the SQL statement.

--
Brendan Reynolds
Access MVP

"bruce" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi, all:
> I have a subform, which RecordSource property is set by VBA. And
> then, I want to bound one of recordset's field to a control, but It
> sounds wrongly. Here is my code:
>
> lngProblemID = Parent.GetProblemID
> strSqlOptions = "SELECT Options.OptID, Options.ProbID,
> Options.OptNote, Options.IsRight FROM Options"
> strSqlOptions = strSqlOptions & " Where Options.ProbID = " &
> lngProblemID
> Me.RecordSource = strSqlOptions
> Me.Requery
>
>
> 'Add new option record
> Set recOptions = Me.Recordset
> recOptions.AddNew
> recOptions.Fields("ProbID") = lngProblemID
>
>
> 'set action property
> With Me!bfrOption1
> .ControlSource = "OptNote"
> .Requery
> .Class = "Word.Document"
> .OLETypeAllowed = acOLEEmbedded
> .Action = acOLECreateEmbed
> End With
>
>
> "OptNote" is one of Recordset's field,which is ole type. After I did
> this, I can edit word in control normally, control's value is allright
> indeed, but the recOptions.Fields("Prob") allways holding at Null.
> What's the trouble with? Could I do it just like this way. If something
>
> wrong, please wise me up! Thank you.
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
vbNewLine in memo field bound control h2fcell Microsoft Access Form Coding 1 6th Jan 2010 02:14 AM
Get the bound field of a control BD Microsoft Dot NET 2 5th Mar 2007 09:56 PM
Get the bound field of a control BD Microsoft C# .NET 1 5th Mar 2007 04:56 PM
How to bound field to control during runtime? bruce Microsoft Access Getting Started 0 31st Aug 2006 02:45 PM
How to bound field to control during runtime? bruce Microsoft Access 0 30th Aug 2006 03:51 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:41 AM.