473,383 Members | 1,725 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Suggestion for default value property setting on page 2 of tab control

MLH
I have a form named frmVehicleEntryForm. It has a 3-tab tab control.
On the 2nd tab page, there's a textbox named VehicleLocationName
whose default value setting is

=DLookUp("[TowCompany]","tblAdmin","[TowCoID]=Forms!frmVehicleEntryForm!TowCoDropDownBox")

The criteria of the DLookUp points to a control on tab page 1. If,
after choosing a company in TowCoDropDownBox, I click tab page 2,
I was hoping to see something like "XYZ Company" in the textbox named
VehicleLocationName. But I don't.

Oddly, if I change VehicleLocationName.DefaultValue property to
=DLookUp("[TowCompany]","tblAdmin")
I get what I want. A company shows up. Of course, its the first
company in the table. And most of the time, that's wrong - I have
35 different companies in that table.

The key seems to be the dlookup criteria. If there is no criteria,
Access looks up the value and puts it in the field. This is a data
entry form. Perhaps something I type into a control really isn't there
- at least not in the way Access wants it to be there when attempting
to READ the contents. Form properties AllowEdits, AllowDeletions,
AllowAdditions and DataEntry are all Yes.

Can I revise my criteria in the DLookUp to overcome my problem? Or,
should I not be trying to read what's in the field at all?
Jun 7 '06 #1
6 2488
If you can get the two values together in a query,. use the query as
the rowsource (or controlsource, can't remember!) of the your combobox.
Set the textbox to be unbound and point it to Me.MyCombobox(1) or
whatever column you want that youre hiding in your combobox. Problem
solved. No code required.

Jun 7 '06 #2
MLH
On 7 Jun 2006 09:37:10 -0700, pi********@hotmail.com wrote:
If you can get the two values together in a query,. use the query as
the rowsource (or controlsource, can't remember!) of the your combobox.
Set the textbox to be unbound and point it to Me.MyCombobox(1) or
whatever column you want that youre hiding in your combobox. Problem
solved. No code required.


Yes, I could do that. One way to do it would be to define a global
variable (gvSomeVar AS Variant) and write a global module to reference
and return the value of gvSomeVar. So there's a solution. Great.

I would still like to get to the bottom of why, on a form like that
I've described, I can set the DefaultValue of a textbox to
=DLookUp("[TowCompany]","tblAdmin","[TowCoID]=21")
==> and it works. But if I set it to
=DLookUp("[TowCompany]","tblAdmin","[TowCoID]=Forms!frmVehicleEntryForm!TowCoDropDownBox")
==> it doesn't work. And if I set it to
=DLookUp("[TowCompany]","tblAdmin")
==> it works.
Jun 7 '06 #3

On 7-Jun-2006, MLH <CR**@NorthState.net> wrote:

=DLookUp("[TowCompany]","tblAdmin","[TowCoID]=Forms!frmVehicleEntryForm!TowCoDropDownBox")

Try this:

=DLookUp("[TowCompany]","tblAdmin","[TowCoID]=" &
Forms!frmVehicleEntryForm!TowCoDropDownBox)

Note the difference in the Where parameter
Jun 7 '06 #4
MLH
On Wed, 07 Jun 2006 19:41:39 GMT, "Rick Wannall"
<wa*****@notadomain.de> wrote:

On 7-Jun-2006, MLH <CR**@NorthState.net> wrote:

=DLookUp("[TowCompany]","tblAdmin","[TowCoID]=Forms!frmVehicleEntryForm!TowCoDropDownBox")

Try this:

=DLookUp("[TowCompany]","tblAdmin","[TowCoID]=" &
Forms!frmVehicleEntryForm!TowCoDropDownBox)

Note the difference in the Where parameter


Well, I crossed my fingers and closed my eyes. Still didn't
work. My first syntax has no problem displaying the correct
TowCo name when run in the immediate window. Your syntax
works too, of course. In the data-entry form, however, nothing
seems to work that provides a reference criteria to the dlookup fn.
Jun 8 '06 #5
MLH
No such luck. I give up on trying to plug in a DefaultValue
property setting that works. Dunno why it doesn't work -
but I do know that it doesn't.

Using the following line in TowCoDropDownBox's AfterUpdate code
works just fine:

Me!VehicleLocationName=DLookup("[TowCompany]","tblAdmin","[TowCoID]=Forms!frmVehicleEntryForm!TowCoDropDownBox")

The only explanation I can come up with as to why putting essentially
the same instruction in the target textbox's DefaultValue property
setting MIGHT not work is because of the form being a data entry
form. But even if that is the controlling factor, I have no clue why.
Jun 8 '06 #6
Are you certain that there's a row selected in the combobox? If there's
not, then there's nothing to compare to, and that will return a NULL value
to the DLookup.
Jun 8 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Bruce Rusk | last post by:
I've just started using Stephen Lebans' RTF2 control in a database, linked to a Memo field, and am finding it extremely useful (incidentally, in ACC2002 I'm using the class and withevents rather...
10
by: MLH | last post by:
I have an A97 table with a Yes/No field named TowJob and a form bound to that table. The TowJob control on the form is bound to the same field. It is an option group with Yes and No bttns valued...
5
by: Chuck Bowling | last post by:
Maybe I'm doing something wrong or just don't understand the concept, but i'm having a problem with default properties. My impression of how a default property should act is this; MyClass c =...
5
by: Nathan Sokalski | last post by:
I have a user control that contains three variables which are accessed through public properties. They are declared immediately below the "Web Form Designer Generated Code" section. Every time an...
3
by: Marty McFly | last post by:
Hello, I have a control class that inherits from System.Web.UI.WebControls.Button. When I drag this control from the "My User Controls" tab in the toolbox onto the form, I want it to reflect the...
4
by: Dennis | last post by:
I am trying to set the default design proerties in a control I have derived from the Panel Class. I thought I'd found how to do it from the MSDN but the following line doesn't work: Inherits...
1
by: clickon | last post by:
I want to use the selected value of a drop down list to filter a data source. When i have done this before i have used a DataSourceControl and i have just made the drop down a control parameter,...
6
by: =?Utf-8?B?U2hhcm9u?= | last post by:
I'm using the VScrollBar and set it as follow: m_vScrollBar.Minimum = -19602; m_vScrollBar.Maximum = 0; m_vScrollBar.SmallChange = 1; m_vScrollBar.LargeChange = 1089; m_vScrollBar.Value =...
3
by: MLH | last post by:
I have a table named tblDoItems. It has a text field named . There is no default value property setting at the table level. I have a query named qryAdminDoList based solely on the table that looks...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.