<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.
>
|