I have a filed and I want to find out its length then in the next column i have to add the data like if filed 1's length is 1 then it should be 000+field1.value, if it is 2 then 00+field1.value, if it is 3 then 0+field1.value and so on...any help is appreciated , thanks
I have a table in Access that I have a form saving new records to. Before this save occurs, I would like Access to check if the account number already exists and if the account does exist if it is outstanding. If both of those conditions are met I would like a message box to display and cancel the save as it is a duplicate. I can't seem to get it to work though.
I was thinking to use a filtered recordset based on one of the conditions and then perform a find on that recordset to see if it is null.
Code:
dim acct as long dim rstfiltered as DAO.Recordset Set rstfiltered = CurrentDb.OpenRecordset("SELECT * FROM tblclstrack WHERE [Request Status] <> 'Completed'") acct = Me.cd_number.Value
I had two tables parent(f1) , child(f1,f2,f3). I had to display f3 value for parent(f1) when f1 has only one f2, if f2 values are more than one for single f1 and if all f3 values are 0 then i should display f3 as 0, else if some values for f3 are nonZeros and some are Zeros then is should display f3 value as '-'.
I am so frustrated right now that I could scream. I have a database which tracks attendance and referrals for a networking organization - it meets weekly on Thursdays. It has a report which displays totals of both attendance and referrals for each weekly meeting for an entire month. The problem I am having is related to the fact that some months have 4 Thursdays and some have 5. If I get my queries to display the meeting dates correctly for the 4-Thursday months, then it displays incorrectly for the 5-Thursday months, and vice versa.
Is there any way to put a criteria on a missing record? If I could have it just populate the 5th week with spaces or null when it doesn't exist for that month, it would make my life a lot easier.
I can send a copy of the database to anyone who thinks they can help. It's too big to post.
For some reason, this one is driving me nuts so i would really appreciate some help. This is kind of complicated to explain but here goes. I am trying to create a query so that, based on certain conditions certain rows from the Form/Table are either visible or not visible on the report. I have four fields involved: Antic Dep$ (Anticipated Deposit Amount) Antic Loan$ (Anticipated Loan Amount) Date Dep Booked Date Loan Booked
Basically i am trying to hide any records that in which the Date Dep Booked and/or Date Loan Booked are older than the current month...
I can think it through logically but cannot get my head around the query.
If Date Dep Booked or Date Loan Booked is not older than current month then show the row; If Date Dep Booked is older than current month and Date Loan Booked is older than current month then hide the row; unless
If Date Dep Booked is older than current month but Date Loan Booked is not older than current month then show the row; except If Date Dep Booked is older than current month and Antic Loan$ is zero then hide the row; but If Date Dep Booked is older than current month and Antic Loan$ is not zero then show the row;
Then i also need to do the reverse for the Date Loan Booked, i.e.
If Date Loan Booked is older than current month but Date Dep Booked is not older than current month then show the row; except If Date Loan Booked is older than current month and Antic Dep$ is zero then hide the row; but If Date Loan Booked is older than current month and Antic Dep$ is not zero then show the row;
Phew! That probably makes no sense but i had to try.
Once again, i appreciate any help so that i can keep the remainder of my hair.
I am trying to do a date query with conditions in excel but it don't seem to work.
I am trying to do a query on a table on the birthdate column and I need the records of all athletes that were born on or after 1/1/2008. Below is what I did but it doesn't seem to work.
Created a design view chose the birth date field and the criteria row I typed >=#1/1/2008#
I'm making the most simple DB where there are bookings consisting of a StartDate and EndDate. The Scenario is a car hire firm. Obviously i don't want to be able to double book a car and want to be able to list all cars available within the two dates (input).
I have set the defult input to 12/07/04(StartDate) and 12/17/04(EndDate) for the purpose of testing.
I have created a query to find all cars which are not available in relation to the input dates, but cannot get it to list the available cars!
SELECT CarDetails.CarReg FROM CarDetails INNER JOIN BookingDetails ON CarDetails.CarReg = BookingDetails.CarReg WHERE (((((([BookingDetails].[StartDate])<#12/7/2004#) And (([BookingDetails].[ReturnDate])<#12/7/2004#)) Or ((([BookingDetails].[StartDate])>#12/17/2004#) And (([BookingDetails].[ReturnDate])>#12/17/2004#)))=False));
I have a parameter query with a totals row that displays averages. Is there a way to have the average row use only specific records in its calculation based on one of the field's values WHILE still displaying all the records returned by the query.I want only data that has a "YES" value used in the average while still displaying the records marked as "NO"
I want to create a calculation query that uses different equations under certain conditions. Here's specifically what I need:
If the "Cost_Category" field is "Full Price" then the query uses the following calculation: Total_Cost: Sum(nz([Program_Cost])+nz([Millage_Fee])+nz([Auditorium_Cost]))
If the "Cost_Category" field is "BOCES" then the query uses the following calculation: Total_Cost: Sum(nz([BOCES_Number_of_Participants])*nz([Cost_Per_Person]))
I have successfully created these two queries individually, but combining them doesn't seem to work. Here's what I wrote:
It keeps coming up with errors, saying that I misplaced a comma, parenthesis or quotation. I've tried playing with it, changing the syntax slightly but it doesn't seem to work.
Basically, if Calendar date > Date(), if Calendar Date not Saturday or Sunday, weekday(Calendar date<>1 and <>7), AND Calendar Date not in (Holidays table).Then repeat the last not = 0 value of MyValue. I thought of changing the default value but the value is already 0, while default is null + I need to set the default value under certain conditions.
I currently have a query which takes its criteria from a form called search. This all works fine, unless the user leaves a field in the search form blank. Then the query has no results. What I'd like is for a blank field to act as a wildcard. I guess the reason this doesn't automatically work is that Access (effectively) puts " & " around the criteria taken from a form, so the criteria ends up as " " not (there's a space there!).
I tried entering a criteria in the query that says: IIF([Forms]![Search]![Date] Is Null,*, [Forms]![Search]![Date] this doesn't work. For one thing Access edits the * into "*", so it is no longer a wildcard. Secondly, I've never used IIF before, so it's probably wrong anyway...
So, can anyone help me do this? Even if a blank field cannot be used as a wildcard, any character would do...
Hope someone can help with this. Had a search through the forums but nothing quite the same (although I'm guessing it's a simple one to solve.)
I need to calculate a figure based on 2 criteria. The permutations are as follows
If condition A is less than 20 and condition B is No then return 9 If condition A is less than 20 and condition B is No then return 12 If condition A is greater than 20 and condition B is No then return 13 If condition A is greater than 20 and condition B is No then return 15
Hi, I have created a Yes/No attribute. Im just wondering if a text boxes visibility can be dependent on the result of this. E.g. If a row is set to yes then the text box will be shown and if it is set to no the text box is made invisible. Thanks for any help
Hi again :) Since I am new to Access I am having a problem figuring out how to set the participation conditions (optional or mandatory) for my relationships. I have looked through MS access online and forums, google etc. and found nothing. I would be very grateful for any help :) Kind Regards Marie
The following SQL statement with 1 where condition works fine, but the Next SQL statement with 2 where conditions does not work, a error message says Run-Time error ‘13’ type mismatch , what is incorrect in the statement when the AND MinID = 15 is added. The table data type in set as number
SQL = "UPDATE MinistryInv2 Set MinID = " & 14 & " WHERE PID = " & Me!ID & ";"
SQL = "UPDATE MinistryInv2 Set MinID = " & 14 & " WHERE PID = " & Me!ID And MinID = 15 & ";"
I have set up a querry that gathers information from different tables:
ID | Name | StartDate | EndDate | NbOfDays |
Then, i am using a form to fill up this querry. Normal stuff.
1- How and where can i set a condition so the input of EndDate could not be smaller than StartDate? 2- How and where can i set up and write the formula that calculates the NbOfDays? (meaning number of days worked form start date to end date)
I have a form that I created that allows the user to input an "ExhibitNo" and then a "PlacingNo" to allow each entry to receive a set monetary amount (based on values in a table).
The "ExhibitNo" has two references linked to it. They are "ClassNo" and "ExhibitorID".
My supervisors want me to make it so that when the "ExhibitNo" is entered on the form that it will not allow a monetary amount.
This is where I started, but it does not work. Does anyone have a better idea?
Private Sub Combo14_AfterUpdate() Me.Refresh If [ClassNo] >= 0 >= 5000 Then If [ExhibitorNo] <= 0 >= 499 Then If [Placinggrade] = "Blue" Then [Premium] = [Blue] End If If [Placinggrade] = "Red" Then [Premium] = [Red] End If If [Placinggrade] = "White" Then [Premium] = [White] End If End If End If
If [ClassNo] >= 5000 Then If [ExhibitorNo] <= 500 Then If [Placinggrade] = "Blue" Then [Premium] = [Blue] End If If [Placinggrade] = "Red" Then [Premium] = [Red] End If If [Placinggrade] = "White" Then [Premium] = [White] End If End If End If
If [ClassNo] >= 5000 Then If [ExhibitorNo] >= 500 Then [Premium] = 0 End If End If
What I need to do is, not have a form pop up when all the conditions are met. I have 30 some users that log into the db.
I have a form that pops up when the date of the project is past due. to certain users when they log in. I am using the Environ("username") theory, which works very well. But when the user has COMPLETED all the necessary dates, the form still comes up, (but of course it’s blank).
i am trying to open a form if all conditions are met. if the conditions are not met, then they get a flash message and then the user should return to the open form. i have the condition checking working but cannot seem to open the form if ALL conditions are true. i also need to close the form when the new form opens.how could i achieve this? here is my code
Private Sub MidVerifyContinue_Click()
FullNameChk.SetFocus
If FullNameChk = False Then MsgBox "You Need to have a Full Name to Verify", vbOKOnly, "Message" End If
If CompNameChk = False Then MsgBox "You Need to have a Company Name to Verify", vbOKOnly, "Message" End If
If TradeNameChk = False Then MsgBox "You Need to have a Trading as name to Verify", vbOKOnly, "Message" End If
If UTChk = False Then MsgBox "You Need to have a number to Verify", vbOKOnly, "Message" End If
If CRChk = False Then MsgBox "You Need to have a C R number to Verify", vbOKOnly, "Message" End If
If NIChk = False Then MsgBox "You Need to have a N I number to Verify", vbOKOnly, "Message" End If
If PostCodeChk = False Then MsgBox "You Need to have a Postcode to Verify", vbOKOnly, "Message" End If
If the value is on field is say "OA" then I need an input code of LL0000 or LL00000 in the next field If the value is say "OT" then I need an input code of LL etc
I'm trying to create an If/Then statement that needs to match to multiple values. My initial thoughts were to create a list but that doesn't seem to work the way I thought it would.
For example: If Me.Field = 1,2,5, or 8 Then Do 'X' Else IF Me.Field = 3,4,6 or 7 THen Do 'Y' Else Do 'Z'
I haven't been able to get the syntax to work right. I'd rather not have to do 'Me.Field = 1 or Me.Field = 2, etc.' but if that's the only way to have it work right, then I guess it'll have to do.
I am trying to calculate [current status] based on multiple conditions. for example
Current status = A , if (w>0 and x=0 and y=0 and z=0)
Current Status =B , if(w>0 and x>0 , y=0 and z=0) Current Status =C , if(w>0 and x>0 and y>0 , z=0) Current status =D , if(w>0 and x>0 and y>0 and z>0)
Where A,B,C,D are text values and w,x,y,z are dates