Save into form

saman

Registered User.
Local time
Today, 12:52
Joined
Dec 30, 2006
Messages
32
hi all,
i want know is there any way that save a text(or value) into a TextBox(unbound) of a form?
thank
 
hi all,
i want know is there any way that save a text(or value) into a TextBox(unbound) of a form?
thank

what are you trying to do?

there is one process i know of that might utilise such a system - one where you have a login form for users, and then 'store' (albeit not in a table) their 'name' for use in other forms (and unbound textbox saying something like: "Current login: Matthew".

There are two ways to achieve this:

1) Ask access to save the information in a Global Variable for use throughout the application. An issue here is that sometimes Access 'loses' this information

2) When your user uses the login form, instead of closing the form, make it invisible when the user clicks "Log on" button - then, you unbound textboxes can point at the control with the user name - this does not have the side-effect of 'losing' the data, because it's always there (just "invisible")

- is this what you are trying to do? (or similar?) more info from your end would be good.
 
Agnieszka

Trust you to get all technical:cool: We all knew what they wanted but were affraid to ask:D
 
what are you trying to do?

there is one process i know of that might utilise such a system - one where you have a login form for users, and then 'store' (albeit not in a table) their 'name' for use in other forms (and unbound textbox saying something like: "Current login: Matthew".

There are two ways to achieve this:

1) Ask access to save the information in a Global Variable for use throughout the application. An issue here is that sometimes Access 'loses' this information

2) When your user uses the login form, instead of closing the form, make it invisible when the user clicks "Log on" button - then, you unbound textboxes can point at the control with the user name - this does not have the side-effect of 'losing' the data, because it's always there (just "invisible")

- is this what you are trying to do? (or similar?) more info from your end would be good.

hi and thank wiklendt
i thought of your opinion is true. is there possible send me sample ?
 
i have posted a DB for a different purpose here, but you can still find what you need in it. with this DB, once you have unzipped it (put the folder "TESTDB" directly onto the C:\ drive of your computer) do the following:

navigate to C:\TESTDB\User\FE.mdb

hold down the SHIFT key while you: double-click and wait to open (don't lift your finger off the SHIFT key until you see the DB has opened)

then, open zfrmLogin in design view, and check out the code behind cmdLogin button.

that is how you make the form invisible and open the next form once a user has logged in (this DB does not demonstrate secure logins, just basic tracking).

to bring the form back to visible, there is a command button on the 'switchboard' (which i have made a custom one by using my own form, not the switchboard wizard), which 'opens' the login form again - zfrmSwitch and cmdChangeUser.

the switch form (zfrmSwitch) also had the current user displayed on the form in an unbound textbox, txtCurrentUser. have a look at the "control source" of that textbox, it points to the zfrmLogin User dropdown.

Code:
=Forms![zfrmLogin].cmbUser.Column(1)
Column(1) is actually the second column - the first column would be "Column(0)".

this database also demonstrates a great many other things that may help you - have a quick read of the supplied instructions to see if you are interested in the other points. mainly to do with FE/BE application and management.

edit: in a different database, i got fed up with always having to use the full reference to the dropdown (besides, if that reference ever changed, i'd need to change it wherever it appeared), and i made a reference by VBA to the form and then the control source refered to the VBA, rather than to the form itself. if i ever wanted to change the name of the login form, i would only need to change the VBA rather than all control sources. i did it this way:

create a standard module and call it something generic, like modFunctions. then, inside i wrote:

Code:
Option Compare Database
Option Explicit
Public Function fstrCurrentUser()

    fstrCurrentUser = Forms!frmLogin.cmbUser.Column(1)

End Function
and whenever i needed the current user, i'd not need to remember the full path to the dropdown control (forms!frmLogin.... etc), all i needed was to type in "=fstrCurrentUser()".

see?
 
Last edited:

Users who are viewing this thread

Back
Top Bottom