Default Value issue

  • Thread starter Cyberwolf via AccessMonster.com
  • Start date
C

Cyberwolf via AccessMonster.com

A little background on what I am doing. I have a form that is opened one of
two ways based on a dialog box that is opened on the forms OnLoad event.

The one way I have it openeing is in data entry mode. At this point 2 fields
are pre-populated with values from the dialog form if they are not blank.
But I also have those 2 fields afterupdate events set to carry over the value
with the defaultvalue function. So what happens is when the form opens (in
datasheet mode) the 1st line contains the correct values, but the 2nd line
contains the 1st records information from the underlying table.

I have not been able to figure out how to populate the 2nd line with the
correct value. Here is my code for both modules.

Private Sub Form_Load()
FormLoad:
stF = "frm:2000RulesTableFilter"

DoCmd.OpenForm stF, acNormal, , , acFormEdit, acDialog
 
J

Jeanette Cunningham

Hi,
you can set the default value in code.
Me.Rules_Table_Name.DefaultValue = ""
you could add this line to the code where DataEntry = True

Me.DataEntry = True
If stTableName <> "" Then Me.Rules_Table_Name = stTableName
If stType <> "" Then Me.Rules_Table_Type = stType
Me.Rules_Table_Name.DefaultValue = ""

Note that the default value for a control is always a
string, so setting it to an empty string clears any default value

Jeanette Cunningham
 
C

Cyberwolf via AccessMonster.com

Thank Jeanette, that seems to have taken care of it.

Jeanette said:
Hi,
you can set the default value in code.
Me.Rules_Table_Name.DefaultValue = ""
you could add this line to the code where DataEntry = True

Me.DataEntry = True
If stTableName <> "" Then Me.Rules_Table_Name = stTableName
If stType <> "" Then Me.Rules_Table_Type = stType
Me.Rules_Table_Name.DefaultValue = ""

Note that the default value for a control is always a
string, so setting it to an empty string clears any default value

Jeanette Cunningham
A little background on what I am doing. I have a form that is opened one
of
[quoted text clipped - 48 lines]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top