Assign The Value At Run Time In SQL Query
Aug 28, 2007
hi..
i want to use this query into my code..
DoCmd.RunSQL "INSERT INTO joint_ledger (owner_ref, value_settled, ClientONo, trans_against, con_veh,) VALUES (" & G_current_client & "," & (G_value_os = 0) & " , '" & G_clientono & "', " & jjref & ",'" & con & "')
the part of statement highlighted in red ...is the value for the filed value_settled whose data type is yes/no..
now i am confused with thise highlighted part..will it assign the 0 to G_value_os or first use the original value of G_value_os to insert the value into database... please help me...
many thanks...
View Replies
ADVERTISEMENT
May 1, 2008
Hi all,
I have a form that runs from a query which combines data from 2 tables. I am trying to set up a filter on the form using a number of combo boxes and text boxes and a command button to fire it but I keep getting the above error (on the .Filter = strFilter line) and I can't see what the problem is with my code.
Private Sub cmdApplyFilter_Click()
Dim strSSType As String
Dim strArea As String
Dim strDepot As String
Dim strStatus As String
Dim strRisk As String
Dim strZone As String
Dim strContractor As String
Dim strFilter As String
If IsNull(Me.cboSSType.Value) Then
strSSType = "'Like '*'"
Else
strSSType = "='" & Me.cboSSType.Value & "'"
End If
If IsNull(Me.cboArea.Value) Then
strArea = "'Like '*'"
Else
strArea = "='" & Me.cboArea.Value & "'"
End If
If IsNull(Me.cboDepot.Value) Then
strDepot = "'Like '*'"
Else
strDepot = "='" & Me.cboDepot.Value & "'"
End If
If IsNull(Me.cboStatus.Value) Then
strStatus = "'Like '*'"
Else
strStatus = "='" & Me.cboStatus.Value & "'"
End If
If IsNull(Me.cboRisk.Value) Then
strRisk = "'Like '*'"
Else
strRisk = "='" & Me.cboRisk.Value & "'"
End If
If IsNull(Me.cboZone.Value) Then
strZone = "'Like '*'"
Else
strZone = "='" & Me.cboZone.Value & "'"
End If
If IsNull(Me.cboContractor.Value) Then
strContractor = "'Like '*'"
Else
strContractor = "='" & Me.cboContractor.Value & "'"
End If
strFilter = "[subSubstationType] " & strSSType & "AND [subArea] " & strArea & "AND [subDepot] " & strDepot & "AND [subStatus] " & strStatus & "AND [subRiskLevel] " & strRisk & "AND [subZone] " & strZone & "AND [subContractor] " & strContractor
With Forms![frmSubInfo]
.Filter = strFilter
.FilterOn = True
End With
End Sub
Any help on this would be greatly appreciated.
View 1 Replies
View Related
Feb 17, 2014
I wanted to assign the field "Number of magazine" with special format based on date/time format but showing only year and month in the format: "yyyy-mm".
So in property of this field in format I put yyyy-mm and in input mask I type 0000-00;;-
I also created the form based on the table containing above field and I defined format and input mask for corresponding formant in the same way like at the table.
But if I try to type date for example 2014-01 in text box of the form it comes up with the full date 2014-01-01. Why does it do like this? What do I do incorrectly?
View 2 Replies
View Related
Aug 8, 2006
hi
i created a query named: qryTest
on a form, i put a subform/subreport (name: resultQuery)
i have also a button
when i click on the button, i would like to run my query: qryTest and i want to display the result to my component: resultQuery
i tried
resultQuerysourceobject = currentdb.querrydefs("qryTest");
i get error syntax....
any idea?
thanks
View 4 Replies
View Related
Feb 20, 2005
I have the following query, which I know works.
The query is called "products_due_in_query"
SELECT Sum([Supplier_order_line].[quantity]) AS [Due_in]
FROM Supplier_order_line
WHERE (((Supplier_order_line.order_line_status)="Awaiting delivery") AND ((Supplier_order_line.product_number)=[product_number_combo]));
product_number_combo is a combobox on a form called "product_enquiry".
I have a text box on "product_enquiry", which I want to show the value of "Due In" (from the query), when the user selects a product_number from the product_number_combo combobox.
How can I do this? I have tried setting the text box control source to products_due_in_query.Due_in but all I get is "#name".
I thought about doing it with VB code, but dont know how.
I have used .recordSource before, to assign a value to a combobox, but I dont know how to do it for a text box.
Can anyone help?
Thanks very much.
View 1 Replies
View Related
Mar 6, 2014
I am total green in access specially in VBA world and trying to learn during my free time..I am able to learn to learn how to assign values to LISTBOX, based on already created Query (using Wizard).Now I am trying to learn, HOW to create the query through VBA and assign to listbox instead of first creating query..What exactly I am trying to learn is upon opening of the my listbox show already existed records (for information)
Following the information
tlb name = Currency
tlbfield1=Currencycode
tlbfield2=Currencyname
[code]....
View 5 Replies
View Related
Dec 18, 2014
I have created a query that counts the AppSizerPerUD for every User Drive (UserDriveID). Now I want to assign these values to the other query (UserDrive Usage) for every UserDriveID. So I want to create a new column in the UserDriveUsage query that will contain the AppSizePerUD. In this case in the first two rows must be 23.6, then one row 18.38, the third one 45,39 etc.I need something like a VLOOKUP in Excel. I have tried DLOOKUP but probably I am not uisng it correctly.
View 3 Replies
View Related
Nov 14, 2013
The Query
'SELECT Count(clubbox) AS MTSingles
FROM moves WHERE (((moves.cmrdate)>[Forms]![CPanel]![Text44] And (moves.cmrdate)<[Forms]![CPanel]![Text46]) AND ((moves.driverid)=[Forms]![CPanel]![Text38]) AND ((moves.move)=35) AND ((moves.clubbox)=32));'
returns about 60 records, how do i assign the results to a tempvars
View 9 Replies
View Related
May 10, 2005
Morning - I have been searching a bit but to no avail. I have a query (qryTopTenList) set up in a database that selects the Top Ten "Classes" from a table with a key field of "insclass".
I have a multi select list box (LstInsClass) that allows end users to select multiple insurance classes. What I would like to do is set up a standard button that when clicked, will loop through all of the insclass in the query "qryTopTenList" and then select those same insurance classes in my multi select list box. So the end result is that 10 records in the List Box would be selected.
This is helpful b/c it prevents the need to go through the entire list box to select the top ten classes.
Thx in advance for any insight. I appreciate it.
Rob
View 1 Replies
View Related
Aug 16, 2013
Using Access 2010: I have a query with four fields: ORG_NAME, PERS_NAME_LAST, CountOfORG_NAME, and BdMbrCount. There are a couple hundred companies in the database with 1-7 people associated with each company. I need to number each person so that they have a number, 1-7 in the MemberCount field of my query.
I have my query connected to VBA code.
I have experimented with code that I have found on the forum, just to see if I could get something to work and I am getting “Undefined function ‘BdMbrCount’ in expression. I am trying to pass [ORG_NAME],[PERS_NAME_LAST] to my function and assign the value of BdMbrCount to a new field in my query, BdMbrCount.
Code:
Function BdMbrNumber()
Dim qdf As DAO.QueryDef
Set qdf = CurrentDb.QueryDefs("YourBdMbrsRRecognizedQry")
'Set rst = CurrentDb.OpenRecordset("SELECT [ORG_Name],[PERS_NAME_LAST],[CountofORG_NAME], [BdMbrCount] FROM YourBdMbrsRRecognizedQry")
Dim ORG_NAME As String
[code]....
View 14 Replies
View Related
Apr 27, 2013
Is it possible to assign a query to the recordsource of a form dynamically? I assume the answer is yes. Can this action be done when the form is not open? If yes what is the correct syntax to use when the code is in a normal module as a public sub? I tried many possibilities and could not get it to work.
Code:
Dim ForNm as string
Dim Qry as string
ForNm = "PersonalFm"
Forms(ForNm).Recordsource = Qry
Forms![PersonalFm].Recordsource = Qry
[Forms]![PersonalFm].Form.Recordsource = Qry
View 14 Replies
View Related
Aug 12, 2015
Created a new Query (called qry_Temp) from and existing Query (qry_Test that has fields Field1 - Field5) using QueryDef , and inserted a new Field (FieldX) into it (see example below) using the .Parameters property, then opened a Recordset based on the new Query in order to attempt to enter data values into the new Field (FieldX) for each record in the query - but cannot assign any data values to this new Field (but can to the existing fields) in the new Query?
Dim DB As Database
Dim rs As DAO.Recordset
Dim qdfNew As QueryDef
Dim strSQL1 As String
Dim strSQL2 As String
Dim Value1 As Integer
[Code] ....
View 6 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
Aug 17, 2006
Hello buddies :D, do you have any idea how to make this work?
To select data that falls within this criteria of date range between cboDate and cboDate2 (fields on my form). The date in [tblJobDetails]![timeIn] come in this format "08/17/06 10:24 AM", but the cboDate/cboDate2 (takes in date only e.g 08/17/06) what i am after is to evaluate specific hard coded time in addition to the date entered, i.e. even tho, i haven't entered time on the cboDate/cboDate2, I want specific time hard coded where e.g If i select a date range of 08/17/06 and 08/18/06 on my cboDate and cboDate2 it should really be evaluating: 08/17/06 8:00 AM to 08/18/06 8:00 AM.
This is the criteria i curentlly have on my query in design view tha works perfect in selecting date only.
([tblJobDetails]![timeIn]>=[Forms]![frmPendingJobs]![cboDate] Or [tblJobDetails]![timeIn]>=[Forms]![frmPendingJobs]![cboDate] Is Null) And ([tblJobDetails]![timeIn]<=[Forms]![frmPendingJobs]![cboDate2] Or [tblJobDetails]![timeIn]<=[Forms]![frmPendingJobs]![cboDate2] Is Null)
How can I incorporate 8:00am to 8:00am into my cboDate and cboDate2. What can i do to make this happen? Your kindness will be greatly appreciated http://www.naijaryders.com/forums/images/smilies/thankyou.gif
View 10 Replies
View Related
Jun 7, 2006
I have a link table with a field in GMT time. I want to convert the times to local time in a query. I know that I should use DateAdd, but I am just wondering how to know summer and winter time. On the summer our local time is +2 GMT and on winter +1.
View 14 Replies
View Related
May 23, 2006
I have an application with a backend db on PC 1, and the same application on PC 2 linked to the backend db on PC 1 via the network.
The link works fine but the time formats are different.
On PC 1 the time format is shortime and displays as it should i.e. in 24 hour clock format
However on PC 2, opening the same database via the network, the time format is still shorttime but when you read the time within the code it comes out in AM/PM format. Also, when the defaul tiem should be #20:00:00# but this changes to #8:00:00 PM#
Weirdly though, when you just open the table, the times are in the correct shorttime format.
Guessing, it must be a setting within the main core of Access 2003 that is different between the 2 instances?
Any ideas?
This screen shot may help:
View 2 Replies
View Related
May 23, 2006
I have an application with a backend db on PC 1, and the same application on PC 2 linked to the backend db on PC 1 via the network.
The link works fine but the time formats are different.
On PC 1 the time format is shortime and displays as it should i.e. in 24 hour clock format
However on PC 2, opening the same database via the network, the time format is still short time but the format is in AM/PM or medium time.
Guessing, it must be a setting within the main core of Access 2003 that is different between the 2 instances?
Any ideas?
View 1 Replies
View Related
Apr 14, 2006
I keep getting this message when I try and input a product ID in the subform in my 'Order Form', the message says 'you can't assign a value to this object' and when i try to click the row below it says 'You cannot add or change a record because a related record is required in table 'Invoices'', how can I change this? do i have to relate it to the Products table and if so how do i do this? Thanks, Bob.
System Link:
Gamez System (http://www.savefile.com/files/5147388)
View 1 Replies
View Related
Apr 20, 2006
hi
in vba i done a query
strQuery
strQuery = "select sum(x) as X, sum(y) as Y from test3"
how to run this query and get sum(x) value, sum(y) value and
set it to label
txtX.caption = ...
txtYCaption = ...
any idea?
thanks
View 1 Replies
View Related
Dec 28, 2005
I have a table set up like this:
tbl_original
account, invoice
11111, 1
22222, 1
33333, 5
44444, 3
I want to create a function module or something similar which will assign a variable to the max invoice # used on that table, using sql if possible. I tried something like this, but it's not working.
Public Function max()
Dim maxinvoice As String
maxinvoice = "SELECT Max(tbl_original.invoice) AS MaxOfinvoice" & _
"FROM tbl_original;"
MsgBox maxinvoice
End Function
I would like the msgbox to popup saying "5", since that is the max invoice # used based on the above table.
I don't have too much experience using modules on their own without forms and variables on the form to assign to, can someone make a suggestion?
Thanks in advance!
Vassago
View 14 Replies
View Related
Apr 17, 2008
Hi Im making a database with a form,
The thing that I dont know is how to do this:
I have two fields in the table , one is a text and the other is YES/No
I want that in a form, I will use a barcode when The value was enter in the form automatically the assign YES in the other field and save it
I need help urgent
View 3 Replies
View Related
Jan 12, 2006
Hello! I'm trying to assign a number to a set of rows so I can, essentially, create a dual primary key on a table. Below is an example of what I have...
654321 | Course 1
654321 | Course 2
123456 | Course 1
123456 | Course 2
123456 | Course 3
123456 | Course 4
123456 | Course 5
The numbers are just "student numbers" if you will. Something that identifies them. The second column is basically the name of a course. What I would like to do is number each row, but only within the group of that individual.
Example:
1 | 654321 | Course 1
2 | 654321 | Course 2
1 | 123456 | Course 1
2 | 123456 | Course 2
3 | 123456 | Course 3
4 | 123456 | Course 4
5 | 123456 | Course 5
Can I accomplish this?
View 5 Replies
View Related
Jan 21, 2006
See Attached database
I have a frm called frmaddprovider Main form see database
I Also i have subform called frmsubformproviderids with
2 command buttons Add Provider ID and Refresh data
When i generate a report by selecting insurance name, insurance id, from the table called tbladdinsurance and also select Provider, Pin from the table called tblproviderids
When i generate the report as you can see by the sample database only insurances that are selected in the combo box shows up
How do I assign a default value so if the insurance combo box in the subform field is left blank it will automatically assign the Pin# to all insurances and when i generate the report it will show all insurances along with provider and Pin#
View 4 Replies
View Related
Mar 19, 2006
I keep getting this message when I try and input a product ID in the subform in my 'Order Form', the message says 'you can't assign a value to this object' please have a look at it, thanks.
Gamez System (http://www.savefile.com/files/4823667)
View 1 Replies
View Related
Mar 27, 2006
Greetings, all.
Run into a snag with a payroll db, appreciate any help you can give me.
Main Form, with ordinary payroll/personnel info--clock no, first and last names, S.S.no., etc.
Subform for entering regular hours worked, OT hours worked, etc per Period Ending, keyed to main form by SS no. Pretty basic stuff.
Problem is, when we try to enter the first data in the subform, we get this error message :
"You can't assign a value to this object.
*The object may be a control on a read-only form.
*The object may be on a form that is open in Design view.
*The value may be too large for this field."
We get the message in the first field we go to, no matter which field we go to first.
None of the "may be" conditions apply.
When we hit "OK" the message goes away and we can enter our data, the records are created corrected. But as soon as we move to the next record, we get the same error.
Any idea why we're getting this error message?
Thanks for looking,
BeckieO
View 1 Replies
View Related
Aug 18, 2006
I have been pulling my hair out (OK, I would be if I had enough to do so) over trying to assign a value to a control on a form. Basically, when a change is made to the form, I'm using the AfterUpdate event to trigger the code. The code in the event is
Me.txtWho = Environ("UserName")
Simple, straightforward or so I thought. Problem is, it gives me an error stating I cant' assign a value to that object. txtWho is bound to a field in the query underlying the form and the control is enabled and not locked. Can anyone shed some light on this for me please????
View 13 Replies
View Related