Group:  Microsoft Access ยป microsoft.public.access.forms
Thread: Unbound Refresh Problem

Geek News

Unbound Refresh Problem
"Andy Roberts" <andy[ at ]blue-bean.co.uk> 12/31/2008 9:43:16 AM
2 Problems.

1. I have a form which displays all the information for each project I
undertake (one project one form). On that form I have a bound combo box
(cboOldJob) which queries all the other projects i have undertaken and
allows me to select a previous project which is linked to the current one.
This works ok.

I have two unbound txt boxes which display the client name and the job
location when I select the job from the bound cbo (cboOldJob). The problem
is that these unbound txt boxes don't refresh / requery when the form is
loaded even though the cbo still has the old job value stored. I have a
requery on the formload event as follows (which doesn't seem to work):-

txtOldJobClient.Requery
txtOldJobSite.Requery

2. I have a button next to the cboOldJob which I want to open a form and
filter the result to the value in cboOldJob. How do I do this?

--
Regards

Andy
___________
Andy Roberts
Win XP Pro
Access 2007
Liverpool, UK


Re: Unbound Refresh Problem
"Jeanette Cunningham" <nnn[ at ]discussions.microsoft.com> 1/1/2009 4:57:11 AM
Hi Andy,
You can use the after update event for cboOldJob to open a form filtered to
that job.

Private Sub cboOldJob_AftetUpdate()
If Len(Me.cboOldJob & vbNullString) >0 Then
DoCmd.OpenForm "[NameOfForm]", , , "[JobID] = " & Me.cboOldJob & ""
DoCmd.Close acForm, Me.Name
End If


If you set up one of the unbound text boxes with its control source =
Me.cboOldJob.Column(1)

It will show the value for the client name for the job selected in the
combo.
When the combo is empty (Null), the textbox will also be empty.
When you change the value in the combo, the textbox will change and show the
matching client name.

Assuming that the second column of the combo has the info about client name.
If it is a different column, change the number for the column in the
textbox's control source expression.
Combo's columns are numbered starting at 0 for the 1st column.

Do a similar thing with the other textbox.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

"Andy Roberts" <andy[ at ]blue-bean.co.uk> wrote in message
news:Yv-dnW1ypptFo8bUnZ2dnUVZ8jKdnZ2d[ at ]bt.com...
[Quoted Text]
>2 Problems.
>
> 1. I have a form which displays all the information for each project I
> undertake (one project one form). On that form I have a bound combo box
> (cboOldJob) which queries all the other projects i have undertaken and
> allows me to select a previous project which is linked to the current one.
> This works ok.
>
> I have two unbound txt boxes which display the client name and the job
> location when I select the job from the bound cbo (cboOldJob). The
> problem is that these unbound txt boxes don't refresh / requery when the
> form is loaded even though the cbo still has the old job value stored. I
> have a requery on the formload event as follows (which doesn't seem to
> work):-
>
> txtOldJobClient.Requery
> txtOldJobSite.Requery
>
> 2. I have a button next to the cboOldJob which I want to open a form and
> filter the result to the value in cboOldJob. How do I do this?
>
> --
> Regards
>
> Andy
> ___________
> Andy Roberts
> Win XP Pro
> Access 2007
> Liverpool, UK
>


Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net