Re: Problem getting screen controls to to populate
- From: "Saga" <antiSpam@xxxxxxxxxxxxx>
- Date: Mon, 6 Jun 2005 14:36:58 -0500
The DoEvents instruction tells VB to pass control of execution to
Windows
so that it can execute any pending instructions. Most likely, Larry
suggested
this approach to create a gap between the execution of the line before
and
after the msgbox.
Your code shows that you are manually assigning the values from the data
recordset to the textboxes. Did you "unbind" these text boxes? I rarely,
if
ever bind my controls using a data control. In fact, if you have chosen
to
not use data binding, as you have shown in your code, I would not use a
data control for this. Insteaad, I would use a recordset variable. You
do not
specify whether you are using DAO or ADO, but here is a quick example
using ADO:
Given: You have established your connection and your connection variable
is
dbConx
dim rs as ADODB.Recordset
-display your search dialog modally here, return the SQL that you
need.
(like maybe select * from table where IdNum=1223)
-open the recordset
set rs = new ADODB.Recordset
rs.open strSQL, dbConx
-Assign values to textboxes
mystruct.field1 = rs!field1 'This assumes these fields are NOT null.
mystruct.field2 = rs!field2
mystruct.field3 = rs!field3
tbf1.text = mystruct.field1
tbf2.text = mystruct.field2
tbf3.text = mystruct.field3
If your search dialog only returns the search clause you will have to
modify it so that it returns the entire SQL statement. The strSQL
variable
shown above could be a public variable that the search dialog uses to
return the SQL.
Good luck!
Saga
"Michael R" <MichaelR@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:79C3DBE1-8522-4BF8-9333-4EACB2DED01F@xxxxxxxxxxxxxxxx
> I'm not familiar with DOEvents and didn't come across it in the VB
> docs while
> I was trying to solve this problem. Is this something that I should
> be using
> to do some sort of cleanup after unloading a dialog?
>
> The problem is that I have to open a msgbox (something else may
> possibly
> work, but I haven't looked) just to get VB to update its own screen.
> I must
> be missing some sort of trigger that tells VB that I really do want it
> to
> execute my code after I close the custom dialog box. Right now, it
> ignores
> the code that posts data to the screen (textboxes) unless I call the
> msgbox
> function.
>
> Also, it may be noteworthy to point out that before I put in the
> manual
> screen updates, the textboxes were linked to a data control as their
> data
> source and did actually show the correct data without the added
> overhead of
> an extra msgbox.
>
> Something else that is wierd...
>
> The data contol returns that it DID find the desired record, and it IS
> pointing to that record, but acts like it didn't even do the
> findfirst. It
> acts like it returned to the first record of the recordset.
>
> "Larry Serflaten" wrote:
>
>>
>> "Michael R" <MichaelR@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote
>> > I am having a problem getting my VB app to update controls on a
>> > dialog
>> > screen. I can only get it to work if I call the MSGBOX function
>> > anytime
>> > after I call my custom dialog.
>>
>> Have you tried substituting DoEvents for your MsgBox command?
>>
>> LFS
>>
>>
.
- References:
- Problem getting screen controls to to populate
- From: Michael R
- Re: Problem getting screen controls to to populate
- From: Larry Serflaten
- Re: Problem getting screen controls to to populate
- From: Michael R
- Problem getting screen controls to to populate
- Prev by Date: Re: Why would I have to use If X = False, instead of If Not X, where X is Boolean?
- Next by Date: Re: Text box with scroll bar has a hole
- Previous by thread: Re: Problem getting screen controls to to populate
- Next by thread: Re: Problem getting screen controls to to populate
- Index(es):
Relevant Pages
|