470,636 Members | 1,526 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,636 developers. It's quick & easy.

Why default value might not be working?

I have a table named tblDoItems. It has a text field named
[Rev]. There is no default value property setting at the table
level. I have a query named qryAdminDoList based solely on
the table that looks like this:

SELECT DISTINCTROW tblDoItems.DoItemID, tblDoItems.Title,
tblDoItems.Details, tblDoItems.Done, tblDoItems.Priority,
tblDoItems.EntryDate, IIf([Priority]=1,"High
Priority",IIf([Priority]=2,"Medium Priority","Low Priority")) AS
PriorityWord, tblDoItems.ProjName, tblDoItems.Pic, tblDoItems.Rev
FROM tblDoItems
WHERE (((tblDoItems.ProjName)=GetProjectName()))
ORDER BY tblDoItems.Priority;

I have a form named frmAdminDoListEntryForm whose recordsourc
is the above named query. It has a textbox control named Rev whose
controlsource property is the field named [Rev]. I have a defaultvalue
setting on that control. I entered =GetCurrentRev() there. That
FN is in a global module. Here it is:

Function GetCurrentRev() As String
GetCurrentRev = MY_VERSION$
End Function

Typing ? GetCurrentRev() in the debug window prints the value
currently assigned to MY_VERSION$ global var.

When I open the form, #Name? is what displays in the textbox.
I don't know why. When I go to new record in that form, the desired
default value is NOT displaying in that form's control as I expected.
Is there something about the query, perhaps, that is preventing the
default value from being used when adding a new record with this
May 21 '07 #1
3 4849
Oops... the name of the textbox control on the form is Text106 -

not Rev. (sorry)
May 21 '07 #2
Also, it is worth mentioning that when I create a brand
NEW form based on the query and I drag ALL the fields
in the Field List over to the form, the control in question
on the form displays the desired default value when I go
to a new record. There are no problems associiatied with
that field at all.

Thix, to me, suggests that something is wrong with the
form I'm working with rather than the query.

I've been dealing with this for more than a year. I know
that must seem ridiclous. But it kicked my ass back then
and I gave up on it. Now that I'm back on the task, it's
still kicking my ass.
May 21 '07 #3
Who knows what the problem was?

All I know is after exporting to text and
rebuilding the form from scratch, all is
working now.
May 22 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

14 posts views Thread by ago | last post: by
3 posts views Thread by Todd D. Levy | last post: by
10 posts views Thread by Brad Baker | last post: by
1 post views Thread by Korara | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.