In Statement + Forms

Apr 20, 2007

I have an sql that runs....

UPDATE ProblemLog SET ProblemLog.Status = "Pending"
WHERE [Problem Number] IN (([Forms]![frmPendEm]![txtProbNo]));

Problem Number is autoGenerated primary key.

When I put in say...26, 27 it updates 0 records.
Put 26 or 27 by themselves and it updates 1 record at a time.

Anybody have any ideas of how this in statment can be accomplished to update multiple records?

Thanks.

View Replies


ADVERTISEMENT

Forms :: IF Statement To Test Null Values In 2 Different Forms

Jun 12, 2015

I have a main form with many subforms. Each subform has couple of ComboBoxes or/and TextBoxes. I want to make sure that end users dont miss completing any of required values. For example, in the subform (Clients), an end user is supposed to put either "Male" or "Female" in the (Gender) ComboBox. In another subform (Job Info), the end user will put info of the job like Wage, Employer, Date of Job Start... ete.

What I want is to get VB IF statement which tests if the textboxes "Wage", "Employer", and "Date of Job Start" in the subform (Job Info) are not null, then the CobmoBox "Gender" in the subform (Clients) should not be null too, with a warning message to complete the missing value.

View 14 Replies View Related

Forms :: SQL Statement With Two Where Conditions

Aug 19, 2013

I cannot get the correct syntax for this. The punctuation for the second where condition is incorrect.

Code:
Me.cboDose.RowSource = "SELECT Label FROM tblLookup WHERE tblLookup.[Med]='" & Me.cboMed & "'" AND tblLookup.[Notes] = "Swallowed"

View 3 Replies View Related

Queries :: Update Statement For A OUTER JOIN Select Statement

Feb 12, 2014

I have the following Select Statement:

SELECTTenant.ID, Tenant.[First Name], Tenant.[Last Name], Tenant.Address, Tenant.City, Tenant.State, Tenant.Zip, Tenant.[Home Phone], Tenant.[Cell Phone], Tenant.[Work Phone], Tenant.[Rented Unit],
Tenant.[Security Deposit], Tenant.[Move In], Tenant.[Move Out], Tenant.TenantID, Tenant.UnitID, Tenant.PropertyID, Tenant.OwnerID, Owner.Company, Owner.ID AS Expr1, Property.[Property Address],

[code]....

Now, I know that something in the UPDATE statement does not match my select statement.What should my Update Statement be, in order to update all the columns in the joined tables?

View 2 Replies View Related

Forms :: IIf Statement - No Variants Detected

Jul 15, 2013

This seems correct, but it is not working.

Code : =IIf([Results]="Negative","No Variants Detected")

View 4 Replies View Related

Forms :: Can Use IIF Statement Within SetValue Expression?

Dec 9, 2013

I'm using A2003 (yes, still). An accounting type form requires the "Type" be entered as either (numeric) 1, 11, or 2. On the same form, one of the three Yes/No fields must be checked as confirmation.

My hope is that I can use the "SetValue" action in a macro.

My first attempt (to set the "Assiniboine" field to "Yes" or "On"):

Item: [Forms]![DisbursementMade]![Assiniboine]

Expression: IIf([Forms]![DisbursementMade]![Type].[AfterUpdate]=1,Yes)

That isn't doing anything for me.

The default value for the "Type" field would normally be 1 (but that presumes the user will not skip past it without confirming it) so I have no default value.

The other two Yes/No fields would also be Set by the same logic: (if Type=11, [Bank]=Yes) (if Type=2, [PettyCash]=Yes)

Alternatively, I've tried the reverse approach: If [Assiniboine]=Yes, SetValue of [Type] to 1 so far without success. I'm not using VBA, since the bookkeeper changes from year to year and there is no Administrator. Although the computer has A2010, and can run an .mdb file with macros, successfully, making changes within A2010 produces an 'embedded macro' that isn't readable in A2003.

View 2 Replies View Related

Forms :: Pop-up Form Based On If Then Statement?

Jul 30, 2014

I need a pop-up form that is based on an if then statement.

For example if there is a certain customer selected on the form and the detailed bill is more than 10 lines long (I have a count field) then I need a box to pop-up that says....

REMINDER: You will need to manually reformat this 500byte file.

I also need another one that pops-up when the record loads that warns if a purchase order field is blank.

View 4 Replies View Related

Forms :: IIF Statement On A Field In Form

May 11, 2013

Is it possible to have a IFF statement on a field in a form?

If there is a field number in a form, can an IFF statement be used to check that value. IFF "field" <= 10, Then it the field highlights red.

View 1 Replies View Related

Forms :: Using IIF Statement On A Continuous Form

Jul 19, 2013

I have a continuous form sfrmAddress which is based on my table tblAddressList. What I am trying to achieve concerns the date fields DateFrom and DateTo.

DateFrom is a bound text box txtDateFrom

I am trying to put an IIf function in the Control Source of unbound text box txtDateTo

=IIf([txtDateFrom]=[qryAddressHistory1]![LatestFromDate],Date(),[tblAddressList]![DateTo])

qryAddressHistory1 returns the LatestFromDate , so the most recent address.

The idea being if it is their most recent address, they have lived there until today, if it is not their most recent address it will display the date contained in the table (when they moved out or DateTo).

I have tried this a few different ways, double and triple checked my references and I'm usually OK with IIf so I don't understand where it's going wrong!

I should add I'm getting the #Name? error all the way down the column when I open the form.

View 3 Replies View Related

Forms :: How To Write Insert Statement

Jul 31, 2014

The row source for the combo-box is

SELECT tbl_p.P_ID, [plast] & " , " & [pFirst] AS Expr1 FROM tbl_p ORDER BY [plast] & " , " & [pFirst];

If notinlist I would like to add the the new name, how should I write the INSERT Statement?

View 1 Replies View Related

Using Forms To Build Sql WHERE Statement For Pass-through Queries

Mar 17, 2006

Hi all, i'm currently working a MDB project that aims to develop a front end access solution for users of the sql database. The system is used only to made adjustments to the WHERE clause of the SQL pass-through statement. The SELECT and FROM statements are pre-determined and users won't need to update this. The result is a read only. You might be wondering why i don't use ADP instead, well one of my limitations is that i won't have write access to the database. They are afraid i will corrupt data...

I want to use a series of text and combo boxes to build my WHERE statement, which will be added to the main SQL statement and then pass-through to the server, making use of its much beta processing capabilities. However as i'm trying to read up on VBA, i still have very little knowledge on how this can be done. Its actually similar to the Filter By Form option in datasheet view when i open a pass-through query. However, conditions applied through here means the processing is done on the user's computer, through testing i found this to be unreliable as it causes access to hang frequently. I would love to have this filter by form view available up front to the user before he even executes the query. As i mentioned, he keys in the criteria/conditions and access builds an sql where statement and appends it to the main SQL statement.

any idea how to do this? how do i capture user input and make access construct a WHERE statement from it For example

textbox daterange
Enter range of dates in here: date 1 and date 2
the where statement would then be "WHERE date BETWEEN date1 AND date2

Or is there other more efficient alternatives? sorry i'm very new to VBA and form development, would appreciate lots of advice and answers.

Many Thanks
Eric

View 1 Replies View Related

Forms :: Object Missing Inside IF Statement

Mar 28, 2015

Code:
Sub ClearDeck()
Dim i As Integer
Dim ToStay As Variant

'Because Access will not allow a Frame and all it's contents to set Visible = False
'Remove all Frame Controls except those to keep outside our Frame

[Code] ...

I'm getting RunTime Error 424 Object Missing on the line inside the if statement. Although it is getting .Controls(i).Name correctly and I would have thought Me is an Object? I also tried the complete Form name but still got the error.

View 1 Replies View Related

Forms :: IIF Statement Returning Incorrect Value In Subform

Jun 16, 2015

I am trying to sum a column on a subform named Cost of New if another column named Final = any of the values listed in my code. However, it is summing the Cost of New column regardless of the values of Final. It is summing for all values.What do I need to modify to make this correct or should I do it another way?

=IIf([Final]="RPR-RPR & RTN" Or [Final]="NFF-TST & NFF" Or [Final]="RTN-RETURN" Or [Final]="SCL-SCR LOCALLY" Or [Final]="SCR-SCR RETURN" Or [Final]="BER-BER RTN CST",Sum([Cost Of New]),Null)

View 3 Replies View Related

Forms :: Delete From Statement Returning 13 Mismatch

Mar 7, 2013

I am trying to delete from a form, the record in the JD SOP TBL where the record Job Description matches the Combo Box "Job Description" on the form, and the Required SOP in the table matches the selection in the list box "SOP List". The list box has multi select to none and both fields are text fields.

Code:
DoCmd.RunSQL "DELETE FROM [JD SOP TBL] WHERE [Job Description] = '" & [Job Description] & "' " And [Required SOP] = " & SOP_List & "

View 5 Replies View Related

Forms :: IIF Statement Within A Field In A Form Not Working

Jun 21, 2013

I am trying to created an IIF statement in a field I have in a form.

I have entered the following statement but it keeps coming up with the following error and I cannot see where I am going wrong.

The expression you entered contains invalid syntax, or you need to enclose your text data in quotes

=IIf([RenewalInstallment]=0,(12-[MFAccepted])*[CurrentAnnualPremium]/12)*(1-[DiscountAccepted]/100),IIf RenewalInstallment]<>0,(12-[MFAccepted])*[RenewalAnnualPremium]/12)*(1-[DiscountAccepted]/100)

If I enter the first part of the If statement i.e.

=IIf([RenewalInstallment]=0,(12-[MFAccepted])*[CurrentAnnualPremium]/12)*(1-[DiscountAccepted]/100)

The field calculates correctly however there seems to be something wrong with the nested if.

View 6 Replies View Related

Forms :: Like Command In IF Then Statement - Syntax Error

Jun 24, 2015

Can I use the Like command in an If Then statement? I'm getting a syntax error

If [Primary1Name] Like 'PO*' Then
MsgBox "You cannot use a post office box address. Use a residence address.", vbOKOnly, "Incorrect Address Information"
DoCmd.GoToControl "Primary1Address1"
Else
End If

View 3 Replies View Related

Forms :: IF Statement Not Putting Data Into Tables?

Apr 1, 2014

I am doing an assignment for uni and need to be able to autofill a textbox with the price of a service based on whether a checkbox, detailing whether the invoice has been paid, is ticked. I found the following formula which works: =IIf([Invoicepaid]=True,[ServPrice],0).

I put this into the control source box on my form but the only problem im having is that the price of the service is not being updated into the actual invoice table.

View 2 Replies View Related

Forms :: Running SQL Statement With Combo Box Values

Apr 4, 2013

I have a form that has a combobox with table names in it. I want to execute a very complicated SQL statement but I want to put the table name (from the combobox) into the SQL statement. I'm planning on making a button to do this, but I don't know how to put the SQL statement in VBS which would use the combobox value as the table name in the SQL statement.

View 2 Replies View Related

Forms :: How To Break Update Statement Into Multiple Lines

Mar 7, 2014

I am unable to break the UPDATE statement into multiple lines and now I am getting "Syntax Error in UPDATE statement"

Following is the multiple line Update Statement

Dim strsql As String
strsql = "Update tblcurr" & _
"SET tblCurr.Currencyname =" & _
"[forms]![updatecurrency]![txtcurname]" & _
"WHERE (((tblCurr.Currencycode)=" & _
"[forms]![updatecurrency]![txtcurcode]));"
DoCmd.RunSQL strsql

Following is the one liner Update statement which, works perfectly

strsql = "UPDATE tblCurr SET tblCurr.Currencyname = [forms]![updatecurrency]![txtcurname] WHERE (((tblCurr.Currencycode)=[forms]![updatecurrency]![txtcurcode]));

View 4 Replies View Related

Forms :: IF Statement - Condition Based On Status Of One Checkbox

Aug 2, 2014

In an access form, I have several checkboxes. There is one checkbox titled "Complete". The complete checkbox needs to be true only if all other "non master" checkboxes are true. If all of the non master checkboxes are not checked, I need the complete checkbox to be false. This is the code that I am currently using on the after update command:

If me.checkbox1 and Me.checkbox2=True then
me.completed=True
else
me.completed=False
end if

This works fine if there is no "and" in the if statement and the condition is based on the status of one checkbox as opposed to many (Also I have about 15 checkboxes that must be checked before the "complete" checkbox is true).

View 14 Replies View Related

Forms :: Create A Button That Executes SQL Statement In A Form

Apr 24, 2013

I want to create a button that executes an SQL statement in a form. The reason I can't just save a query and run the query from the form, is because the SQL statement needs to use a combobox value from the form. I've learned that docmd.runsql will not work for a simple select query.

View 5 Replies View Related

Forms :: Filter Statement Asks For Parameter Entry

Aug 22, 2014

I have a bound form, in its heading I have a combo box which lists three choices. Basically I want to filter all my purchase records by checking a field PUOrderNb (Example: PO200100025) against the choice made in the combo box, namely DE (for demand), PO (for Purchase order) etc. On the after update event of the combo box, I have the following code:

Dim strfilter As String
strfilter = " left ([PuOrderNb],2) like " & cboFilter.Column(1)
Me.Filter = strfilter
Me.FilterOn = True

When I make a choice in the combo box, I get a window asking me to enter a parameter value and it lists the value of the combo box choice as a sort of a title just above the white input fame.When I type in PO for instance, the program does correctly filter all order numbers starting with PO, but the whole point of having a combo box is not to have to type anything.The other odd thing is, when I change the choice in the combo box, after my first choice, I do not get this parameter question but nothing happens as to filtering. The first choice remains active.

View 3 Replies View Related

Forms :: Nested IF Statement To Check If Input Box Is Null On Form

May 9, 2014

I have a form in my Access database that has 3 input boxes by which a user can locate a record by. The problem I am running into is that I can not get a nested IF statement to work properly to first check which of the search boxes are filled in and second search by whichever is filled in. I have come up with the following code that seems to be only searching by the first input box. If the first input box is blank it does not move to the second or third numbers so I imagine there may be something wrong with the order of my IF statement or the syntax is off.

View 14 Replies View Related

Forms :: Adding All Selection To Combo Box That Acts As Filter For SQL Statement

Nov 4, 2014

My form has a combo box which is bound to a query that selects a list of member numbers. The value selected the goes onto filter a list driven by an SQL statement.

Code:
Private Function PopulateADO(qpMemberNo As Long)
Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
Set cnn = CurrentProject.Connection
Set rst = New ADODB.Recordset

[Code] .....

This works fine when a single member is selected from the combo. But obviously i want a "select all" or * wildcard option.

Question is 2 parts.
1. How do i add the all or wildcard option to the bound combo?
2. How do i code the all or wildcard option into the SQL statement?
Is it something like is not null ?

View 8 Replies View Related

Forms :: Form Control With Iif Statement To Show Specific Records?

Jul 13, 2015

I have a form based on a query in datasheet view. What i would like is to show only those records that fulfill the truepart of iif statment, and do not show the ones that fulfill the false part.

I have the following fileds in the query

month
currency 1 checkbox
currency 2 checkbox
sum

In the form, the control named month contains the following code:

control source: =IIf([checkbox1]=no;[month];0)

So this gives the appropriate months, but also shows the all other records with a 0 in the month field. I would like to get only the records shown that are correct with the truepart of the statement.

View 6 Replies View Related

Queries :: IIF Statement With And In True Statement

Oct 31, 2014

I have a query with the following criteria in one of the fields:

>=DateAdd("m",-12,fom()) And <=DateAdd("m",1,fom())

fom is a function for first of the current month. I need this query to be specific to what month it is when its ran so i want to only have this criteria if the month is > = october. If it isnt October or greater, i want the criteria to reflect this.

>=DateAdd("m",-12,fom()) And <=fom()

Which also works by itself. But when i add it to an iif statement it always produces no results. Below is the iif statement.

Iif(month(date())>=10, >=DateAdd("m",-12,fom()) And <=DateAdd("m",1,fom()),>=DateAdd("m",-12,fom()) And <=fom())

I have also added the column name to each expression and it still doesnt produce any results.

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved