473,320 Members | 2,124 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,320 software developers and data experts.

losing Default Value on dataentry

EJO
I've looked around the groups and don't have tried some of the various
suggestions to no avail. So I'm hoping someone can help me out here.
I have a form that, when a cmd button is clicked, changes the property
of the form to dataentry. On this form, there are two fields that
have a default value set. The one default value set using the
property sheet is getting the value from a numeric field on a
different form and is working just fine. The one not working just
fine has its default value set using vba according to the tab control
which I use to filter the records on the form and is a text field.
Both fields are bound.

When the form changes to 'dataentry' mode, the default value of the
text field set in vba gives me '#Error.' This is how I am setting the
default value (the text changes per the tab control):

Me.mycontrol.DefaultValue = "E"

I have tried

Me.mycontrol.DefaultValue = " 'E' "

as well as

Me.mycontrol.DefaultValue =" ' "E " ' "
(this gives me a 'compile error: expected: end of
statement)

Any idea why this cannot be set?

TIA,

Eric

Jun 15 '07 #1
1 1799
Try:
Me.mycontrol.DefaultValue = """E"""

For an explanation of the quotes, see:
Quotation marks within quotes
at:
http://allenbrowne.com/casu-17.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"EJO" <My****@gmail.comwrote in message
news:11**********************@c77g2000hse.googlegr oups.com...
I've looked around the groups and don't have tried some of the various
suggestions to no avail. So I'm hoping someone can help me out here.
I have a form that, when a cmd button is clicked, changes the property
of the form to dataentry. On this form, there are two fields that
have a default value set. The one default value set using the
property sheet is getting the value from a numeric field on a
different form and is working just fine. The one not working just
fine has its default value set using vba according to the tab control
which I use to filter the records on the form and is a text field.
Both fields are bound.

When the form changes to 'dataentry' mode, the default value of the
text field set in vba gives me '#Error.' This is how I am setting the
default value (the text changes per the tab control):

Me.mycontrol.DefaultValue = "E"

I have tried

Me.mycontrol.DefaultValue = " 'E' "

as well as

Me.mycontrol.DefaultValue =" ' "E " ' "
(this gives me a 'compile error: expected: end of
statement)

Any idea why this cannot be set?

TIA,

Eric
Jun 16 '07 #2

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

Similar topics

2
by: David Mitchell | last post by:
I have a multiuser database which VBA to return the current users NT logon. The database has a table which contains the names of all users and a field called bmlogon which holds their NT logon. ...
1
by: Tim Marshall | last post by:
Given a bound continuous subform in an unbound main form, a button on the subform sets allowadditions = true and dataentry = true. This works no problem. But a second button on the subform...
4
by: Keith-Earl | last post by:
I have been writing ASP.NET apps since the RTM build and have never seen this. I built a simple app that uses session variables on my DEV laptop. All runs well. I have a simple toggle routine...
3
by: ACaunter | last post by:
Hi all, I'm wondering why I keep losing my session variables all the time. I've set the timeout to be an hour, but for some reason randomly i keep losing everything.. what could be causing this??...
5
by: cFleury | last post by:
Hi, I have a public structure which is initialized only at startup time but at least one of the elements of this structure is losing its value, this particular element is ONLY initialized at the...
6
by: Bob Quintal | last post by:
Using Access '97. I have a subform, where the .AllowAdditions property is set to false. I have a button labelled 'Add record' that sets this property = true, followed by a DoCmd.gotoRecord...
7
by: jim Bob | last post by:
Hi, I have a search form and upon double click on a name in the list box, a Candidate details form pops up. (no edits etc allowed, only viewing). I have a second form in dataentry mode which is in...
6
by: MLH | last post by:
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 ...
5
by: chromis | last post by:
Hi there, I've recently been updating a site to use locking on application level variables, and I am trying to use a commonly used method which copies the application struct into the request...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
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: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.