assinging a value to a click button

JahJr

Andy
Local time
Today, 14:41
Joined
Dec 3, 2008
Messages
93
I have several forms that are similar. They all log data to the same table when the LogData button is clicked on each form. Is there a way to assign a value to each LogData button in the different forms so when the data is logged i will know which form the data came from.

Thanks
 
maybe create a field in your table named FormNumb
then for each form button assign this field a value like:

private sub yourbutton_click()
me.FormNumb = 1
'rest of code here'
end sub
 
Is there a way of doing this without adding another field to the form or at least not a visible field?
 
where do you want to save the data (form info)? iow, can you add another table field?
 
Making the field not visable will solve most of the problem. But I need a field in each form that will always post the same data to the table. For examble.
Form1 Logs data to Table1 The field could post a 1 in table
Form2 Logs data to Table1 The field could post a 2 in table
Form3 Logs data to Table1 The field could post a 3 in table

In the table there is a column titled Form and I need it to show a 1, 2, or 3 depending on what form the data came from.
 
Use the same field for each form and change the code on the button to store a 1,2,or 3 different for each form.
 
Im assuming that your 3 forms are built off the same table

Access 2007 view design tools add existing fields select Form field or what ever you named it (if you haven't already done this) do this for each form then on the button you want to preform this action add the code 1 for form 1, 2 for form 2 etc.....

private sub yourbutton_click()
me.FormNumb = 1
'rest of code here'
end sub
 
Set the default value to what you want to post. Thank you for your help.
 
Ha sorry sometimes the simple answer evades me.

Glad you figured it out
 

Users who are viewing this thread

Back
Top Bottom