Insert query from form

smti

New member
Local time
Today, 14:25
Joined
Jun 17, 2013
Messages
4
Hi Everyone:

I am currently in the process of designing a database for a department which scans tests. Effectively the the database will contain information on how each person prefers to have their tests scanned and the reports they require.

I created a form titled: FrmCreateNewProfile which contains the following fields:

Employee Number
Barcode (So we can tie the record to a barcode).
Pref. Reports

Once the information has been entered, the user clicks a button which is linked to an append query.

Problem: When the append query runs, it adds several records (usually) three instead of the ONE record I wanted to insert. How can I simply insert one record instead of several?

Here is my query:

INSERT INTO TblProfiles ( [Employee ID], Barcode )
SELECT [forms]![FrmCreateNewProfile]![txtEmployeeID] AS Expr1, [forms]![FrmCreateNewProfile]![txtBarcode] AS Expr2
FROM TblProfiles;

I tried using just a simple INSERT but it appears that in order to get information from the form I have to use an insert with a select.

Any help you could provide would be greatly appreciated!

- smti
 
Yeah, but it don't see how I can use the where clause. I cannot use say, the ID of the record because it has not been added yet. I do not want to query for the next ID either as this can sometimes cause problems.
 
INSERT INTO TblProfiles ( [Employee ID], Barcode )
Values( [forms]![FrmCreateNewProfile]![txtEmployeeID], [forms]![FrmCreateNewProfile]![txtBarcode] );
 
And if it is in VBA

"INSERT INTO TblProfiles ( [Employee ID], Barcode )
Values( [Forms]![FrmCreateNewProfile]![txtEmployeeID], Chr(34) & [Forms]![FrmCreateNewProfile]![txtBarcode] & Chr(34) & " );
 

Users who are viewing this thread

Back
Top Bottom