Clearing Fields from a Form

G

Guest

Is it better to clear the fields when closing a form or when opening?

Either way, I am having trouble clearing the fields from the text box. There
is a combo box in the Header and a text box in the Detail section. When
opening the form, there is no data in the combo box but the text box still
holds the info from when the form was closed.

I have tried several methods to try and close this but either I am doing it
wrong or using the incorrect method. I have tried me.CONTROLNAME = "". I have
tried setting the data entry property of the form to Yes. I have tried On
Load - DoCmd.GoToRecord,,acNew Record.

None worked or I got an error message that there was a problem communicating
with the OLE server of Active X Control.

Could someone point me in the right direction?

Thanks you.
 
G

Guest

Why are you trying to clear the text box?

If there is no need for the value in that text box, then make sure it's
unbound.
Make sure that the text box is not linked to a field in the table, that way
it wont be stored.

Also, check the form load or the OnCurrent event event mybe there code there
that assign a value to that text box
 
G

Guest

Thank you!
This is where I show my lack of knowledge of Access. The text box displays
the text description of the code chosen from the combo box. The text box is
linked to the description field in the table. If I make the text box unbound,
how do I get it to display the text description for the chosen code?

Thanks again!
 
G

Guest

The control source for the text field is the description field in the table.

The combo box lists the codes available, also from the table.

The form is linked to the table.
 
G

Guest

To display the description of the code selected from the combo you can use
(you might have done this)

The Combo RowSource should include both fields Code and Description

Select Code, Description From TableName

The ColumnCount of the combo should be 2.

In the Text Box Control source you can write
=[ComboName].Column(1)

Note: The column count start with 0
I hope I understand what you are trying to do.
 
G

Guest

THANK YOU!
I think this is exactly what I needed.

Can the row source for a combo box be an SQL statement involving more than
one table?

-danu

Ofer Cohen said:
To display the description of the code selected from the combo you can use
(you might have done this)

The Combo RowSource should include both fields Code and Description

Select Code, Description From TableName

The ColumnCount of the combo should be 2.

In the Text Box Control source you can write
=[ComboName].Column(1)

Note: The column count start with 0
I hope I understand what you are trying to do.

--
Good Luck
BS"D


Danu said:
The control source for the text field is the description field in the table.

The combo box lists the codes available, also from the table.

The form is linked to the table.
 
G

Guest

Yes, it's just like any other query

--
Good Luck
BS"D


Danu said:
THANK YOU!
I think this is exactly what I needed.

Can the row source for a combo box be an SQL statement involving more than
one table?

-danu

Ofer Cohen said:
To display the description of the code selected from the combo you can use
(you might have done this)

The Combo RowSource should include both fields Code and Description

Select Code, Description From TableName

The ColumnCount of the combo should be 2.

In the Text Box Control source you can write
=[ComboName].Column(1)

Note: The column count start with 0
I hope I understand what you are trying to do.

--
Good Luck
BS"D


Danu said:
The control source for the text field is the description field in the table.

The combo box lists the codes available, also from the table.

The form is linked to the table.



:

What do you have in the control source of the text field?

--
Good Luck
BS"D


:

Thank you!
This is where I show my lack of knowledge of Access. The text box displays
the text description of the code chosen from the combo box. The text box is
linked to the description field in the table. If I make the text box unbound,
how do I get it to display the text description for the chosen code?

Thanks again!

:

Why are you trying to clear the text box?

If there is no need for the value in that text box, then make sure it's
unbound.
Make sure that the text box is not linked to a field in the table, that way
it wont be stored.

Also, check the form load or the OnCurrent event event mybe there code there
that assign a value to that text box
--
Good Luck
BS"D


:

Is it better to clear the fields when closing a form or when opening?

Either way, I am having trouble clearing the fields from the text box. There
is a combo box in the Header and a text box in the Detail section. When
opening the form, there is no data in the combo box but the text box still
holds the info from when the form was closed.

I have tried several methods to try and close this but either I am doing it
wrong or using the incorrect method. I have tried me.CONTROLNAME = "". I have
tried setting the data entry property of the form to Yes. I have tried On
Load - DoCmd.GoToRecord,,acNew Record.

None worked or I got an error message that there was a problem communicating
with the OLE server of Active X Control.

Could someone point me in the right direction?

Thanks you.
 
G

Guest

It's working!!! However, I also need to add a FIND NEXT button to find any
additional instances of different text descriptions for the code. I added a
counter field to the table which I called Tracker and entered the code below:

Sub Find_Next Click ()
CurrentRecord = [Tracker]
DoCmd.GoToControl "Combo4" (COMBO BOX)
DoCmd.FindRecord [DSC_CDE_DSC] (COD TO FIND), , , , , , False
DoCmd.GoToControl "cmdFind_Next" (CONTROL BUTTON TO FIND NEXT INSTANCE
OF CODE ENTERED)
If [Tracker] = CurrentRecord Then
MsgBox "No more matches have been found for the discount code
you entered.", 48
End If

I get the message "This property is read only and can't be set." The first
line is highlighted in the cmdFind_Next Click() window.

Can you help?

-danu

Ofer Cohen said:
Yes, it's just like any other query

--
Good Luck
BS"D


Danu said:
THANK YOU!
I think this is exactly what I needed.

Can the row source for a combo box be an SQL statement involving more than
one table?

-danu

Ofer Cohen said:
To display the description of the code selected from the combo you can use
(you might have done this)

The Combo RowSource should include both fields Code and Description

Select Code, Description From TableName

The ColumnCount of the combo should be 2.

In the Text Box Control source you can write
=[ComboName].Column(1)

Note: The column count start with 0
I hope I understand what you are trying to do.

--
Good Luck
BS"D


:

The control source for the text field is the description field in the table.

The combo box lists the codes available, also from the table.

The form is linked to the table.



:

What do you have in the control source of the text field?

--
Good Luck
BS"D


:

Thank you!
This is where I show my lack of knowledge of Access. The text box displays
the text description of the code chosen from the combo box. The text box is
linked to the description field in the table. If I make the text box unbound,
how do I get it to display the text description for the chosen code?

Thanks again!

:

Why are you trying to clear the text box?

If there is no need for the value in that text box, then make sure it's
unbound.
Make sure that the text box is not linked to a field in the table, that way
it wont be stored.

Also, check the form load or the OnCurrent event event mybe there code there
that assign a value to that text box
--
Good Luck
BS"D


:

Is it better to clear the fields when closing a form or when opening?

Either way, I am having trouble clearing the fields from the text box. There
is a combo box in the Header and a text box in the Detail section. When
opening the form, there is no data in the combo box but the text box still
holds the info from when the form was closed.

I have tried several methods to try and close this but either I am doing it
wrong or using the incorrect method. I have tried me.CONTROLNAME = "". I have
tried setting the data entry property of the form to Yes. I have tried On
Load - DoCmd.GoToRecord,,acNew Record.

None worked or I got an error message that there was a problem communicating
with the OLE server of Active X Control.

Could someone point me in the right direction?

Thanks you.
 

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