how to write code in VBA to insert data to table from form?
Thank you for taking the time to report an issue.
What's wrong... Please write below.
For example I have the following database table Fields.
Name EmpId secondname
and I looking the data to be updated in the table as follows
Asif 589 Pasha
Through code or by running query
The table opens but only the first record is updated. The code works well as a standard VBA search code on another form.
However, the problem I am facing is that when I try to edit the form (design view) or close the form, it gives an error:
ODBC --call failed
Cannot Insert the value NULL into the column. Column does not allow nulls. INSERT fails. The statement has been terminated.
When this error starts to appear, I am unable to view the form in design view or save it. But I am able to make entries to the table.
I am using this VBA code for the 'Add Record' button:
I want to know in which control user edit data and I want to insert only edited controls data in other table. how can I write insert query
Table Name: tblAwardsLog
4 fields: LastName , FirstName , Recommended , DateInitiated
All fields are TEXT fields. even DateInitiated
I have this Awards Log almost to where I want it, but just can't seem to get this one thing to work right.
I guess I can read this using some VBA code posted at | [LINK] and | [LINK], add an Instr function to it so that when I read the text file, I know when to | insert the data properly in the table.
1. Is there another way I can directly import the data into an Access 2007 table without VBA code? I know Access allows import from data, but my data is not as formatted as I want so the data might end up being in the table in a way such as:
function to it so that when I read the text file, I know when to insert the data properly in the table.
1. Is there another way I can directly import the data into an Access
2007 table without VBA code? I know Access allows import from data, but my data is not as formatted as I want so the data might end up being in the table in a way such as
2. If I have to use VBA, are the methods I linked to proper(Am I going
in the right direction) and advisable or are there better/easier ways to do what I want to achieve.
I have two tables and I want to insert records to one table, using the data on fileds on the other table ?
how can I do this ?
what is the simplest way ?
AFAIK I can use ADO connection to read the data from one table and the use INSERT command on the other one, but that is really a pain especially when there is more than 20 fields .
is there a better way ?
is it possible to access tables and their data directly (not with ADO) in VBA macros