Topics Search

Insert Query With Condition

Insert Query With Condition
Views: 0
if you have three fields (name, age, address) and the two fields are already filled, how do you make and insert query where the condition it chooses the row where that third field is not yet filled?

for example:

INSERT INTO table VALUES address WHERE name = "abc" and address = null
Sponsored Links:

More topics

 

Catching record id in a form

Preview
I have a INSERT INTO query to upload and download a table between a local access table and a online sql server table and a UPDATE query to do the same. I have this connected to a button in a form.

My issue is instead of doing the INSERT INTO and UPDATE queries for all the records in the table I would like to have a WHERE condition for my current record ID in my form (the ID being the primary key), so only the one record in a form is altered and passed between the local access table and the online sql server table.

So how do I catch the record ID of one row in the form and pass it as an arguement for the WHERE condition in my INSERT INTO and UPDATE queries. I want to do this via a button in the form
 

Macro If Condition.

Preview
I want to run a Query-B based on condition of another Query-A in Macros or VBA Code.

Query-A | Select name from employee where inserted_date= date() //today's date

Query-B -- bla bla

My Need is if Query-A returns any values, Query B need to be executed. I Tried with IF CONDITION in macros but its saying table name not found.
 

LIKE Condition (using wildcards) in Access 2007

Preview
The LIKE condition allows you to use wildcards in the where clause of an SQL statement in in Access 2007. This allows you to perform pattern matching. The LIKE condition can be used in any valid SQL statement - select, insert, update, or delete.
 

INSERT with SELECT query.

Preview
I have a SELECT query whose results I need to INSERT into another table. Currently I have made the query an Insert query but this makes testing and development difficult. Most times I just need to browse the records returned without inserting them as they already exist in the target table. I have kept a separate copy of the query as SELECT but keeping them both updated is also demanding. Is it possible to use an INSERT statement with Currentdb.Execute and pass the SELECT query as an argument/parameter instead of individual records?
 

INSERT with SELECT query.

Preview
I have a SELECT query whose results I need to INSERT into another table. Currently I have made the query an Insert query but this makes testing and development difficult. Most times I just need to browse the records returned without inserting them as they already exist in the target table.

I have kept a separate copy of the query as SELECT but keeping them both updated is also demanding.

Is it possible to use an INSERT statement with Currentdb.Execute and pass the SELECT query as an argument/parameter instead of individual records?
 

Print Question

Preview
I have a macro that generates a report based on a query with a date range condition and a field value condition of -1. When the macro runs and both conditions are met I get what I want. However when the -1 condition fails, or is 0, I still get the report with #error which is to be expected.

I have tried using the where conditon field in the macro and set it so the field value is equal to -1 but I still get the report with the #Error.

Is there a way to not have the report print when the second condition is not -1?
 

Subform query code

Preview
on one of the textboxes on my SUBFORM I put a condition on the "on lost focus" event that if the data entered on the textbox is already stored on my table it will open a new form showing the previous record of which it has the same value. my problem is I don't know how to create a query with a condition from a subform. this is the condition of the query I put on my criteria of my query:

field = [Form].[Form Name].[field value]

it doesn't work tough, it'll ask for the value to be entered manually. how do I code the query if the field value is from a SUBFORM
 

Query criteria in linked table

Preview
I'm relatively new to the Access game but amd trying to extract some data from a healthcare database that I have created.

There is the main table with standard/simple data which has a linked table that allows multiple values to be entered. I have created queries that will count how often each individual response has been entered however I want to create a query that tells me how many records have more than one (multi)value selected.

This would mean that in our reporting we could say x% of people have this condition, x% of people have this condition, x% of people have this condition while x% of all respondents had more than one condition.

NB. The linked multivalue table has approx 20possible responses while the main table has about 1000 records
 

Filtering a Query

Preview
I have a Query with a calculated filed. The field is holding the value of either "1" or "2" based on the iff statment I created. can someone help me with how to filder this query to show me only the records witha value of "1" and then save the filter. I have tried the "filter by selection" but when i get out of the query and then go back in the query is unfiltered again.

If I try and write a condition in the "condition" field then when I run the query it wants to prompt me for input.
 

Append Query - Insert Unique Records only

Preview
I am trying to make an Append Query for insertion of data from one table to another, Is it possible to insert only the unique data without any criteria like chkbox=true etc (I mean only insert unique records).

I have noticed that every time when you run append query it can insert duplicate of record?