Append specific records within a form by using a button!

  • Thread starter Thread starter cooteshaun
  • Start date Start date
C

cooteshaun

How do i append single records by using a button? i tried doing an
append querie but only append rows which i DO NOT want could anybody
help me im using VB in Access 2000

Thanks
 
Private Sub Inactivate_Click()
On Error GoTo Err_Command24_Click

Dim stDocName As String

stDocName = "Append_to_Inactive"
DoCmd.OpenQuery stDocName, acNormal, acEdit

Exit_Command24_Click:
Exit Sub

Err_Command24_Click:
MsgBox Err.Description
Resume Exit_Command24_Click

End Sub

Thanks what ive curretnly got!!

Can you help thanks!
 
INSERT INTO GME_users_MGO_access_to_IBC_Inactive ( Plant, Surname,
[First Name], [Net ID], IA, IC, WV1, [Update] )
SELECT TOP 1 GME_users_MGO_access_to_IBC.Plant,
GME_users_MGO_access_to_IBC.Surname, GME_users_MGO_access_to_IBC.[First
Name], GME_users_MGO_access_to_IBC.[Net ID],
GME_users_MGO_access_to_IBC.IA, GME_users_MGO_access_to_IBC.IC,
GME_users_MGO_access_to_IBC.WV1, GME_users_MGO_access_to_IBC.Update
FROM GME_users_MGO_access_to_IBC, GME_users_MGO_access_to_IBC_Inactive;
Sorry thats my SQL from the query
 
Yes it is displayed on the form no none are unique there the same for
every record in my table!

Thanks btw
stumac said:
Is the record you want to append displayed on the form where you are pressing
the command button? Are any of the fields unique to that record?

DBAmat said:
INSERT INTO GME_users_MGO_access_to_IBC_Inactive ( Plant, Surname,
[First Name], [Net ID], IA, IC, WV1, [Update] )
SELECT TOP 1 GME_users_MGO_access_to_IBC.Plant,
GME_users_MGO_access_to_IBC.Surname, GME_users_MGO_access_to_IBC.[First
Name], GME_users_MGO_access_to_IBC.[Net ID],
GME_users_MGO_access_to_IBC.IA, GME_users_MGO_access_to_IBC.IC,
GME_users_MGO_access_to_IBC.WV1, GME_users_MGO_access_to_IBC.Update
FROM GME_users_MGO_access_to_IBC, GME_users_MGO_access_to_IBC_Inactive;
Sorry thats my SQL from the query
stumac said:
have you put a where clause in your append query defining what record you
want to be appended?

Can you post the SQL of your query or the code you are using?

Stu


:

How do i append single records by using a button? i tried doing an
append querie but only append rows which i DO NOT want could anybody
help me im using VB in Access 2000

Thanks
 
if you meen the records yes there all unique records there all
different users
stumac said:
Sorry I meant any of the values within the fields unique?

DBAmat said:
Yes it is displayed on the form no none are unique there the same for
every record in my table!

Thanks btw
stumac said:
Is the record you want to append displayed on the form where you are pressing
the command button? Are any of the fields unique to that record?

:

INSERT INTO GME_users_MGO_access_to_IBC_Inactive ( Plant, Surname,
[First Name], [Net ID], IA, IC, WV1, [Update] )
SELECT TOP 1 GME_users_MGO_access_to_IBC.Plant,
GME_users_MGO_access_to_IBC.Surname, GME_users_MGO_access_to_IBC.[First
Name], GME_users_MGO_access_to_IBC.[Net ID],
GME_users_MGO_access_to_IBC.IA, GME_users_MGO_access_to_IBC.IC,
GME_users_MGO_access_to_IBC.WV1, GME_users_MGO_access_to_IBC.Update
FROM GME_users_MGO_access_to_IBC, GME_users_MGO_access_to_IBC_Inactive;
Sorry thats my SQL from the query
stumac wrote:

have you put a where clause in your append query defining what record you
want to be appended?

Can you post the SQL of your query or the code you are using?

Stu


:

How do i append single records by using a button? i tried doing an
append querie but only append rows which i DO NOT want could anybody
help me im using VB in Access 2000

Thanks
 
No every value is different sorry!!

Im not to good on DB



Sorry if I am not being clear, lets say for example the [NET ID] Field is
unique in each record you could change the SQL of your query to:

INSERT INTO GME_users_MGO_access_to_IBC_Inactive ( Plant, Surname,
[First Name], [Net ID], IA, IC, WV1, [Update] )
SELECT
GME_users_MGO_access_to_IBC.Plant,
GME_users_MGO_access_to_IBC.Surname, GME_users_MGO_access_to_IBC.[First
Name], GME_users_MGO_access_to_IBC.[Net ID],
GME_users_MGO_access_to_IBC.IA, GME_users_MGO_access_to_IBC.IC,
GME_users_MGO_access_to_IBC.WV1, GME_users_MGO_access_to_IBC.Update
FROM GME_users_MGO_access_to_IBC, GME_users_MGO_access_to_IBC_Inactive
Where (((GME_users_MGO_access_to_IBC.[Net ID]) =
FORMS![Append_to_Inactive]![NET ID]));

If the [NET ID] is not always different, is there a field or combinations of
fields where the value is?

Hope this makes sense.

Stu

DBAmat said:
if you meen the records yes there all unique records there all
different users
stumac said:
Sorry I meant any of the values within the fields unique?

:

Yes it is displayed on the form no none are unique there the same for
every record in my table!

Thanks btw
stumac wrote:

Is the record you want to append displayed on the form where you are pressing
the command button? Are any of the fields unique to that record?

:

INSERT INTO GME_users_MGO_access_to_IBC_Inactive ( Plant, Surname,
[First Name], [Net ID], IA, IC, WV1, [Update] )
SELECT TOP 1 GME_users_MGO_access_to_IBC.Plant,
GME_users_MGO_access_to_IBC.Surname, GME_users_MGO_access_to_IBC.[First
Name], GME_users_MGO_access_to_IBC.[Net ID],
GME_users_MGO_access_to_IBC.IA, GME_users_MGO_access_to_IBC.IC,
GME_users_MGO_access_to_IBC.WV1, GME_users_MGO_access_to_IBC.Update
FROM GME_users_MGO_access_to_IBC, GME_users_MGO_access_to_IBC_Inactive;
Sorry thats my SQL from the query
stumac wrote:

have you put a where clause in your append query defining what record you
want to be appended?

Can you post the SQL of your query or the code you are using?

Stu


:

How do i append single records by using a button? i tried doing an
append querie but only append rows which i DO NOT want could anybody
help me im using VB in Access 2000

Thanks
 
yeh copied and paste but comming up with enter paramount and yes the
NET ID is always different
Im getting a bit confused, Ok is the [Net ID] field unique to only the record
you are looking at on the form? Is your form showing you data direct from a
table or from a query (if its from a query, can you post the sql for that so
I can understand what you are seeing)

If the [NET ID] is totally unique (i.e. always different) to the record you
want to copy then the SQL posted would work.



DBAmat said:
No every value is different sorry!!

Im not to good on DB



Sorry if I am not being clear, lets say for example the [NET ID] Field is
unique in each record you could change the SQL of your query to:

INSERT INTO GME_users_MGO_access_to_IBC_Inactive ( Plant, Surname,
[First Name], [Net ID], IA, IC, WV1, [Update] )
SELECT
GME_users_MGO_access_to_IBC.Plant,
GME_users_MGO_access_to_IBC.Surname, GME_users_MGO_access_to_IBC.[First
Name], GME_users_MGO_access_to_IBC.[Net ID],
GME_users_MGO_access_to_IBC.IA, GME_users_MGO_access_to_IBC.IC,
GME_users_MGO_access_to_IBC.WV1, GME_users_MGO_access_to_IBC.Update
FROM GME_users_MGO_access_to_IBC, GME_users_MGO_access_to_IBC_Inactive
Where (((GME_users_MGO_access_to_IBC.[Net ID]) =
FORMS![Append_to_Inactive]![NET ID]));

If the [NET ID] is not always different, is there a field or combinations of
fields where the value is?

Hope this makes sense.

Stu

:

if you meen the records yes there all unique records there all
different users
stumac wrote:

Sorry I meant any of the values within the fields unique?

:

Yes it is displayed on the form no none are unique there the same for
every record in my table!

Thanks btw
stumac wrote:

Is the record you want to append displayed on the form where you are pressing
the command button? Are any of the fields unique to that record?

:

INSERT INTO GME_users_MGO_access_to_IBC_Inactive ( Plant, Surname,
[First Name], [Net ID], IA, IC, WV1, [Update] )
SELECT TOP 1 GME_users_MGO_access_to_IBC.Plant,
GME_users_MGO_access_to_IBC.Surname, GME_users_MGO_access_to_IBC.[First
Name], GME_users_MGO_access_to_IBC.[Net ID],
GME_users_MGO_access_to_IBC.IA, GME_users_MGO_access_to_IBC.IC,
GME_users_MGO_access_to_IBC.WV1, GME_users_MGO_access_to_IBC.Update
FROM GME_users_MGO_access_to_IBC, GME_users_MGO_access_to_IBC_Inactive;
Sorry thats my SQL from the query
stumac wrote:

have you put a where clause in your append query defining what record you
want to be appended?

Can you post the SQL of your query or the code you are using?

Stu


:

How do i append single records by using a button? i tried doing an
append querie but only append rows which i DO NOT want could anybody
help me im using VB in Access 2000

Thanks
 
QUALITY THANKS MATE
Save the Query as Append_to_Inactive ( you may want to rename your original
query first. Do not run it direct, run it from the form where you created
the command button earlier. Just one note the field NET ID will need to be
on the form somewhere (does't have to be visible).

Stu



DBAmat said:
yeh copied and paste but comming up with enter paramount and yes the
NET ID is always different
stumac wrote:
Im getting a bit confused, Ok is the [Net ID] field unique to only the record
you are looking at on the form? Is your form showing you data direct from a
table or from a query (if its from a query, can you post the sql for that so
I can understand what you are seeing)
If the [NET ID] is totally unique (i.e. always different) to the record you
want to copy then the SQL posted would work.
:
No every value is different sorry!!
Im not to good on DB
stumac wrote:
Sorry if I am not being clear, lets say for example the [NET ID] Field is
unique in each record you could change the SQL of your query to:
INSERT INTO GME_users_MGO_access_to_IBC_Inactive ( Plant, Surname,
[First Name], [Net ID], IA, IC, WV1, [Update] )
SELECT
GME_users_MGO_access_to_IBC.Plant,
GME_users_MGO_access_to_IBC.Surname, GME_users_MGO_access_to_IBC.[First
Name], GME_users_MGO_access_to_IBC.[Net ID],
GME_users_MGO_access_to_IBC.IA, GME_users_MGO_access_to_IBC.IC,
GME_users_MGO_access_to_IBC.WV1, GME_users_MGO_access_to_IBC.Update
FROM GME_users_MGO_access_to_IBC, GME_users_MGO_access_to_IBC_Inactive
Where (((GME_users_MGO_access_to_IBC.[Net ID]) =
FORMS![Append_to_Inactive]![NET ID]));
If the [NET ID] is not always different, is there a field or combinations of
fields where the value is?
Hope this makes sense.
Stu
:
if you meen the records yes there all unique records there all
different users
stumac wrote:
Sorry I meant any of the values within the fields unique?
:
Yes it is displayed on the form no none are unique there the same for
every record in my table!
Thanks btw
stumac wrote:
Is the record you want to append displayed on the form where you are pressing
the command button? Are any of the fields unique to that record?
:
INSERT INTO GME_users_MGO_access_to_IBC_Inactive ( Plant, Surname,
[First Name], [Net ID], IA, IC, WV1, [Update] )
SELECT TOP 1 GME_users_MGO_access_to_IBC.Plant,
GME_users_MGO_access_to_IBC.Surname, GME_users_MGO_access_to_IBC.[First
Name], GME_users_MGO_access_to_IBC.[Net ID],
GME_users_MGO_access_to_IBC.IA, GME_users_MGO_access_to_IBC.IC,
GME_users_MGO_access_to_IBC.WV1, GME_users_MGO_access_to_IBC.Update
FROM GME_users_MGO_access_to_IBC, GME_users_MGO_access_to_IBC_Inactive;
Sorry thats my SQL from the query
stumac wrote:
have you put a where clause in your append query defining what record you
want to be appended?
Can you post the SQL of your query or the code you are using?
Stu
:
How do i append single records by using a button? i tried doing an
append querie but only append rows which i DO NOT want could anybody
help me im using VB in Access 2000
Thanks- Hide quoted text -- Show quoted text -
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top