Queries :: Use Inserted Value Dynamically At Run Time
Oct 16, 2013
I am inserting a new record into a 'master' table. Primary key is generated using a sequence. Now using that newly inserted primary key value, I need to insert a new record in child table. These 2 insert queries need to run at the time of deployment. how shall I store that primary key in a variable so that I can use it immediately in next insert statement?Can I use a returning into clause?
View Replies
ADVERTISEMENT
Jul 13, 2015
Could I change my unbound textbox (txtperiod) on the Report to display the time period.i.e.
Weekly, Monthly, Quarterly
Criteria is BeginDate and EndDate on main form.
View 1 Replies
View Related
Mar 29, 2015
From a info sheet on RTB Using the Add, Clear, and Remove methods, you can dynamically populate the control with embedded objects at run time. Can those 'embedded objects' be controls, e.g. list boxes, labels etc ?
View 3 Replies
View Related
May 23, 2006
Hi Guys
my database is essentially a questionnaire of around 200 questions. I'm trying to add a 'light' version to it.
I've added a 'include in light verion' tick-box to all the questions and a 'light analysis' tick box on the registration page.
The questions are all genertated via queries pulling out the appropriate ones as required. What I'm tying to do is add to these queries so that if the 'perfomr light analysis' tick box is ticked only those questions that have been indicated as light are included, and if it's not all teh questions are included.
I can do either-or but not both dynamically
Can anybody help?
Thanks
scube
View 1 Replies
View Related
Sep 16, 2013
Is it possible to have a dynamic whereclause to a query?
I.e. one that is generated by a Function?
E.g.
Code:
SELECT a, b, c
FROM MyTable
WHERE GetWhere()
GetWhere will then return a string like 'a > 3 AND b < 3'
I have tested this scenario and it is not working, so maybe there is some work around?
View 4 Replies
View Related
Nov 19, 2013
I can create a select query with a combo box in it by changing the property of one of the fields - making the display control to combo box and adding the values. No problem there.
What I want to do is to be able to create a query dynamically from vba using a CreateQueryDef statement.
The problem is that you can only pass an SQL string to CreateQueryDef, and the combo box values are not part of the SQL code, but are saved with the query (presumably the same way column layout gets saved).
Is there a way to create a query with VBA and include non-SQL layout criteria so I can have combo boxes?
I'm using Access 2002.
View 6 Replies
View Related
Nov 6, 2013
Is it possible to add a field (i.e., variable) to a query (or SQL programming) based on a form selection?For instance, if I use a form to allow an end-user to specify which fields they wish to include in the query (essentially creating a UI for the query builder), how would I go about creating the query/SQL or updating the query/SQL?
View 3 Replies
View Related
Aug 23, 2005
I am just starting with access and I have a VERY stupid question. I made a combobox (it gets its values from a table with 2 colums the first the ID and the second is the products) when a user selects one of the products in the combobox the combobox is supposed to update another table with that value (and I mean the product name) yet what it updates is the ID # of the product that was selected!! How do i go around this.
I am new to access so i am not sure how things are done yet in access, i am pretty good in VBA in excel, but this is a new front for me that I am trying to learn. I did the above combobox using the wizard.
Layth
View 2 Replies
View Related
Jul 18, 2013
I am trying to create an Access database where I can let the employees enter their time-in and time-out, at the end of their shift. I already created this function working, but running into another issue. Everyday, employees need to enter a break. Sometimes they take a break and sometimes they don't, if they work shorter hours. Thus, the break is not a default 30min and has to be enterd by the employee.
Below is the code I have to calculate the total hour:
txtCalcTime has the below code in control source:
=Int([CalcTime]/60) & ":" & Int([CalcTime] Mod 60)
Control source for this form "FrmTimes" property, in which Txtcalctime resides:
QryTimes
"QryTimes" query has the code below:
SELECT TimeID, TimeIn, TimeOut, Brake, DateID, DateDiff("n",[TimeIn],[TimeOut]) AS CalcTime
FROM EmpTimes;
This shows the total number of hours worked. But how can I make it to substract the break time entered by the employee in "txtbreak" on FrmTimes
View 12 Replies
View Related
Nov 3, 2014
I have finger print machine and i already connect to it and get all log.then i tray to get data and here is the code that im using
SELECT Format(CHECKINOUT.CHECKTIME,"dd/mm/yyyy") AS CDate, IIf([CHECKINOUT.CHECKTYPE]=I,Format(CHECKINOUT.CHECKTIME,"hh:nn:ss ampm")) AS StartTime, Format(CHECKINOUT.CHECKTIME,"hh:nn:ss ampm") AS EndTime, USERINFO.USERID, USERINFO.Name, CHECKINOUT.CHECKTYPE
FROM CHECKINOUT INNER JOIN USERINFO ON CHECKINOUT.USERID=USERINFO.USERID
WHERE (((Format([CHECKINOUT].[CHECKTIME],"dd/mm/yyyy"))='10/04/2014'));
how i get end time due to CHECKTYPE]=O
View 1 Replies
View Related
Oct 9, 2014
I need a Select Query to display data on a form. When an order is appended to my table the field named Printed is updated with the time it was appended. When my form opens it needs to display the field Printed and a field I call MinutesFromPrint. This field needs to display the total minutes elapsed from the time in the Printed field to the current time. My expression is not working.
MinutesFromPrint: DateDiff("n",[Printed],Now())
Here are a couple of samples of my results when I run the query at 7:49 A.M.:
Printed MinutesFromPrint
2:35 60366554
5:07 60366402
View 11 Replies
View Related
Jan 5, 2007
I have a subform generated by a query, I then have a double click function to run a further query this works when I open the subform separatly, but if I open the form and then double click on the field in the subform this will give me a error!
View 5 Replies
View Related
Feb 18, 2005
Hello I have another prob. I need to be able to take a new ID from the topics table and insert it into the messages table after a form has been posted. I haven't got a clue on how to do this.
Its for a message board where a new topic is inserted. Two tables need to have records inserted, the topics table and messages table. The Topic_ID from the topics table is an autonumber and needs to go into the TopicID field in the messages table. Here's my insert query:
sqlString = "Insert into Topics (Topic, BSection, Username, MesDate) values ('" &_
Topic & "', '" & BSection & "', '" & Username & "', '" & MesDate & "')"
Con.execute(sqlString)
sqlString2 = "Insert into Messages (Username, Member_ID, Topic, Message, MesDate, BSection) values ('" &_
Username & "', '" & UserID & "', '" & Topic & "', '" & Message & "', '" & MesDate & "', '" & BSection & "')"
Con.execute(sqlString2)
I've tried using the identifier command but that didn't work so I haven't got a clue on what to do. Can anyone help?
thanks
Grant
View 14 Replies
View Related
Feb 19, 2006
Hello,
Im using a ASP and MS Access 2000 database. What im trying to do is: I insert a row into a table, in that table is a field that auto increments. after I insert this row I want to immediately after that be able to retrieve the value of the column containing the auto increment and hold it in a variable so i can use it for other things....
can anyone help me with this? I have been messing around with SQl cursors but cant seem to get it to work right..
Thank you very much
-Justin B.
Edit/Delete Message
View 4 Replies
View Related
Sep 10, 2013
I have this code in Access VBA and it is not working.
Private Sub btnAddWorkingday_Click()
Dim strSQL As String
Dim strDate As Integer
Dim lastID As Integer
strSQL = "INSERT INTO tblSchoolWorkingDays (CALENDAR_DATE) VALUES ('" & tBoxDateToAdd.Value & "'); SELECT @@IDENTITY AS LastID;"
DoCmd.RunSQL strSQL
End Sub
View 7 Replies
View Related
Jun 22, 2005
I have the following tables, tblAudit and tblCriteria. The first records companies and period of audit, the second contains the criteria against which they will be audited. The audit period determines which criteria apply.
Results are recorded in a third table, tblAuditResults.
Relationships
tblAudit 1:M tblAuditResults M:1 tblCriteria
My problem is when I try to add a new result by selecting a criteria via a combo box a new row is inserted in the criteria table as well as in the result table. Inserting a row in the criteria table is wrong.
I have attached the database for you to look at.
Thanks for any advice you can offer.
Fearless
View 3 Replies
View Related
Apr 27, 2006
New here, looks like a great resource.
I have a question about a form which has several fields on it. What I need to do is to capture the ALL the fields of the record I just entered(updated or inserted)
So, for example, if my form has fields for
RepID, RepName, Company
After I edit or insert a new record, when I click to the next line, is there a way I can use AfterUpdate event to capture ALL the fields that were just updated on the form, and do whatever it is I need to do with them? I hope I am amking myself clear. Thanks for taking the time to look.
View 6 Replies
View Related
Apr 24, 2013
I have a table of nursery school children, names, addresses etc etc. One field is Under 2? Is there a validation rule (or something like) that will automatically put Yes (or No) depending on today's date and the child's date of birth?
View 6 Replies
View Related
Feb 13, 2013
With the following VBA code, I'm trying to select the text value from a textbox and fill that in a query to select the code from a person. (a password only login).
However, I'm getting a run time error 3078 at the '' Set rs = db.OpenRecordset("strSQL")'' line.
Code:
Private Sub Tekst6_AfterUpdate()
Dim strSQL As String
Dim strBarcode As String
Set db = CurrentDb()
'strBarcode = Me.Tekst6
'MsgBox strBarcode
[Code] .....
View 8 Replies
View Related
Oct 17, 2014
I have created a From with some Fields: Name, Surname, Netto Price, Tax (%) and Gross Price..... to make a invoice.
The Problem is that i cant insert the data from: Tax and Gross Price in to the DB.I have tried this:
select Tax Field--> Property Sheet -> Control Source: =[Price]*0,19
example:
Netto Price: 100
Tax 19%-- =[Price]*0,19 = 19
Now I get the correct values displayed in Field Taxes.But this this sum cant not insert in to the Database.I use MS Office 2013.
View 9 Replies
View Related
Mar 13, 2012
I have a text box on my table form with the expression =([LINES]-[MISSED LINES])/[LINES] which gives me the results I want but I also want this total to go to the "On time %" column in my table.
View 3 Replies
View Related
May 31, 2006
Hi there,
I have used Calendar controls before but this is a new one on me?!
When i click on the Calendar, what i am doing is inserting the date clicked into a textbox on another form.
The Calendar is set to todays date the system date is also correct and although i click on 31/05/06, what is being inserted is 31/05/20 ?????
Any ideas, because i dont?
Thanks in advance
View 5 Replies
View Related
Oct 22, 2012
I am exporting a report from access. The problem is after export to .rtf, all fields appears correct except a bar code field (CCode39). It adds a space after the text which makes text non-recognizable by bar code scanner.If I use other formats, then there is no problem. I tried by using plain text as well rich text format for that particular field.
View 1 Replies
View Related
Sep 4, 2013
I have a table that holds company information for the user - eg farm name, company name, manager, phone number and email address etc. Its simply used to provide headers for reports, so that the same generic database can be used on several farms. There is only one record in this table tblfarmdetails.The second table tblorder is for orders and receipts - I currently have code that allows the user to send an order request by email to the manager, and to also send notice of receipt of goods through to the manager. I would like the code to get the email address from the unrelated table.Can I reference this field in the vba?
Private Sub cmdemailorder_Click()
Dim orderdate As String
Dim stafford As String
Dim item As String
Dim itemamnt As String
[code]....
View 8 Replies
View Related
Jan 3, 2013
i want to insert a calculated value of a e.g field6 (field4 * field5) in forms into the database table. by using expression builders in my forms. i have made that feild and on click it shows the calculated value but on filling in the rest of the form and clicking on Insert button does not update this calculated field but iserts all other fields.
View 3 Replies
View Related
Aug 20, 2013
I have elected to have tables inserted into my forms. For example on the School Information form, I have the Employees table inserted at the bottom so that it will show the employees that are assigned to that school when it's pulled up.
Before I split my database into a BE/FE situation, I could expand the items in the tables to other related items, but now that option is gone.
Is there any way to get that back with a split database?
View 7 Replies
View Related