View Full Version : Appending one record using a button


Sharks2431
06-26-2007, 07:25 AM
Hi all. I've done a search for my problem, but its rather specific so I thought I'd just go ahead and post it.

I'm trying to set up a Verify type thing. A handful of users are able to "verify" the correct data in a form that has been inputted by other users. I want these "verifiers" to click a button on the main form and by doing this, all of the data in the form will be sent to a totally different table (I know this isn't efficient and you're not supposed to have the same data in 2 different tables, but it's the best thing to do in my situation). Right now I have a button that is tied to a Append query. It works, except for the fact that everytime someone hits the button it copies over every single record on the table again and again. So my small database of only 1000 records or so shot up to 2000 when the button was hit twice and 3000 when it was hit 3 times and so on.

Is there any way to append one record - specifically the record the user is currently accessing on the form?

pbaldy
06-26-2007, 07:26 AM
You want to add a criteria to your query so it only selects the one record displayed on the form.

Sharks2431
06-26-2007, 07:41 AM
That sounds simple enough. I'm not familiar enough with queries or access in general to know what to put in the criteria box though. Is it going to have something to do with OnCurrent or something like that?

pbaldy
06-26-2007, 07:54 AM
I wouldn't think so. It sounds like you're firing off a saved query? If so, open it in design view. In the column that is the "key" field (the field that uniquely identifies that record), right-click in the criteria box and select Build. Navigate to the control on the form that contains that field. You'll end up with something like:

Forms!FormName.ControlName

Sharks2431
06-26-2007, 08:11 AM
Ah ok, that wasn't too bad at all then. I do have one more question though if you have time. I use a sequence number that is not an autonumber, but is actually a record number. I placed a textbox on my form which displays the record number and then tied it to a column on my table. So, to my users, its essentially the same thing as an autonumber.

I do still have an autonumber going, but it's not displayed on the form and is hidden on the table. I currently have the autonumber as my primary key as well. Do you think it would affect anything if I used the sequence number (record number) as my primary key?

It does tie into this post because now when I click my Verify button, it asks for the specific Sequence number (which is the record number). I think if this number was my primary key, it wouldn't ask for the number. Maybe I'm wrong though. Either way, thanks for the timely help.

pbaldy
06-26-2007, 08:27 AM
Presuming your number is unique, I don't see why you couldn't use it for this. Having said that, if you put the correct form reference in, the query shouldn't "ask" for the number, it should get it from the form.

Sharks2431
06-26-2007, 08:47 AM
Well I actually found I had to point the refernce towards the table because when I did the form and went to previous records and hit the button, it would add the record to the end of the table. Now I have it on the table and instead of adding it to the end, it keeps it in the same place.

It's still asking for the number for some reason. I'm not sure why exactly. I put this [ProdLine_Table]![SEQNo] in my criteria. SEQNo is the record number that appears in the textbox and ProdLine_Table is the table im appending to. It's not a huge deal because the number can easily be found the form, but it is a minor inconvience.

pbaldy
06-26-2007, 08:50 AM
The order of records in the table is irrelevant (and not reliable), but if you're happy, I'm happy.

Sharks2431
06-26-2007, 08:54 AM
I'm happy. Thanks again for the help.