Re: Problem getting screen controls to to populate

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




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


.



Relevant Pages

  • What is the normal way to handle NotInList
    ... I handle my notinlist with a recordset. ... I will trap the not in list in the event for that control, ... MsgBox to find out if they want it to be added ...
    (microsoft.public.access.formscoding)
  • RealNetworks RealGames StubbyUtil.ShellCtl.1 ActiveX Control (InstallerDlg.dll v2.6.0.445) Multiple
    ... RealNetworks RealGames StubbyUtil.ShellCtl.1 ActiveX Control ... Multiple Remote Commands Execution ... CreateShortcut-> allows to create arbitrary executable files inside the automatic ... ProductName: InstallerDlg Module ...
    (Bugtraq)
  • Re: Simple Insert Into...
    ... The form is based on an SQL in the form's Record Source property, ... holds the current text in the control, ... Sometimes the unbound controls do have a value (such as when they are set ... I need this value to assign a unique ID to the entire recordset being ...
    (microsoft.public.access.modulesdaovba)
  • Re: Select query with parameters
    ... I can use data grid control if it will be better for my situtaion. ... When you Open a recordset you pass an SQL query statement as a string. ...
    (microsoft.public.vb.database.ado)
  • Re: Macro Doesnt Work When Worksheet Protected
    ... .ShowInput = True ... .ShowError = True ... MsgBox "Enter additional control lines under Type of ...
    (microsoft.public.excel.programming)