Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Include Date in Memory in Append Query

Status
Not open for further replies.

TimTDP

Technical User
Joined
Feb 15, 2004
Messages
373
Location
ZA
In Access 2000, I want to run an append query, but include data that is in memory into a field in the append to table
I have the following:
Public UserId as integer
When the append query runs I want to include the UserId in the field "UserId" in the append to table. In this way I will know who did what!
 
If you're generating the SQL from within the application you can just add the variable in. Something like (for example purposes):
Code:
UserID = "HarleyQuinn"
strSQL = "SELECT YourField FROM YourTable WHERE UserID = [red]'" & UserID & "'"[/red]
And this would translate into:
Code:
SELECT YourField FROM YourTable WHERE UserID = [red]'HarleyQuinn'[/red]
Hope this helps

HarleyQuinn
---------------------------------
Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
I was hoping to run an append query
 
You can run an append query, just apply the logic I used in my example to your query. If you're having trouble when trying that, post your query and we can have a look for you.

Cheers

HarleyQuinn
---------------------------------
Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
If you mean that you wish to run an append query from, say, the query window, you could use a user defined function:

[tt]Function WhichID()
WhichID=UserID
End Function

Query in SQL View
Insert Into TheTable (UserName) Values (WhichID())[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top