write variables into the tables (1 Viewer)

otis1969

Registered User.
Local time
Today, 21:13
Joined
Mar 13, 2003
Messages
42
I have a form and it works fine...so far, but i have a variable that i would like to write into a table in the database. since i have no idea how to do this i was hoping someone could help me out!!

ex: strName=me.txtName.text

my table contains an autonumber ID and name field. How do i write the strName to the table?
 

Jack Cowley

Registered User.
Local time
Today, 21:13
Joined
Aug 7, 2000
Messages
2,639
If txtName is a bound control on your form to the Name field in your table then:

Me.txtName = strName

will save the value in the variable strName to the Name field in your table.

I am unsure of what you want to do and where the strName is coming from so a bit more detail on what you are trying to do will help so we can tell you what to do....

Jack
 

otis1969

Registered User.
Local time
Today, 21:13
Joined
Mar 13, 2003
Messages
42
here is what is going on...

i have a form to enter new fishermen. the form works fine getting new data into the table. the only thing is that if a user partially fills out the form, then either clicks the 'exit' button or the close form (X), there is a partial record that sits in the table. the primary key of the table is an autonumber (if this info helps).
 

George Too

Registered User.
Local time
Today, 16:13
Joined
Aug 12, 2002
Messages
198
You can put code behind the exit button so that it checks all the necessary fields for empty values and prevent the form from closing. This will force or alert the user that he/she is not finished entering all the data. You can also hide the "x" button so that the user is forced to only exit thru your "Exit" button.
In general, this will in a way, prevent partial entries to your tables.

Regards,
George
 
R

Rich

Guest
Use the Before Update event of the form or use the tag property of the controls you wish to validate
 

Users who are viewing this thread

Top Bottom