• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 353
  • Last Modified:

Getting data from a form instead of a table

I have a form that displays a box with values taken form a table with a field named [Works Order No].
The box  is locked and the only way to change it is to use ‘Find’.
If a user searches for a value then it is successfully displayed in this box.

I have used the OnLoad event as me.Works_Order_No to initially read what value is in the [Works Order No] field. This works OK.

Once the form is loaded AND the user uses 'Find' to get a new value for [Works Order No] the new value is successfully loaded in to the box but I cannot read it with VBA.
That is the value me.Works_Order_No remains ‘out of context’ ( in the watch window).

In VBA, how can I get the value out of a box on my FORM once it is loaded?

0
usatrfe
Asked:
usatrfe
  • 2
  • 2
  • 2
1 Solution
 
hnasrCommented:
Unuable to reproduce the issue.
Attach a sample form and instructions to demonstrate the problem.
0
 
usatrfeAuthor Commented:
THe attached DB is only a test version as the original has too many dependencies upon other DBs.

Have a look a the WorksOrder form.

The VBA has a global variable that is succesfully loaded when I launch the form.

But if the user changes the data within that form (by using the 'find' facility) then I cannot find any event to capture the new value that is in that Works Order box.

I need this revised value to overwrite the prevous Forms_displayed_works_order_no value.

I await your kind reply!


UnitSerNoTest.accdb
0
 
Helen FeddemaCommented:
It isn't clear how you are doing the Find.  I made another textbox on the form that shows the current value in the original textbox.  The Load event code referenced a nonexistent control.  The control originally had the same name as its bound field (not a good idea), so I gave it the standard txt prefix.  You could set a global variable (or a custom database property) from the AfterUpdate event of the textbox, or some other event.  I am attaching the modified database.
HBF-Modified-UnitSerNoTest.accdb
0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
Helen FeddemaCommented:
Perhaps you could add an unbound combo box to search for a value, and then update the variable from its AfterUpdate event.
0
 
hnasrCommented:
Suply step by step instructions to reproduce the problem.
Ex: Open form ..., you see ..., select Find, type ...and so on.
0
 
usatrfeAuthor Commented:
A combobox has worked partly. But the combobox is far clearer for the user than my 'Find' method.

I have resolved the problem as follows:-
The user does not need to use the 'Find' faciltiy (part of Access, at the bottom of the form).
The user instead selects a value from the combo box (this is bound to a field specifically created to store any strings - I called it LiveMSG).
The event 'BeforeUpdate' reads the current value of LiveMSG and loads into my Global variable.
Then I clear the LiveMSG field so that the Table is tidy again.

It may be a bit messy but it does works.


Thanks to all that contributed.
0

Featured Post

Granular recovery for Microsoft Exchange

With Veeam Explorer for Microsoft Exchange you can choose the Exchange Servers and restore points you’re interested in, and Veeam Explorer will present the contents of those mailbox stores for browsing, searching and exporting.

  • 2
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now