i already make this sql for dlookup table for may insert button, all going good, but when i'm going to make double command with different msg box for different criteria, it going fail
1. This my Working code:
If Me.txtidborang.Tag & "" = "" = (DLookup("NoGerankod", "HutangKeseluruhan", "NoGerankod='" & Me.txtnogeran & "'")) Then MsgBox "Grant Number Invalid", vbOKOnly Me.[cbostatuspembayaran] = "Geran Negatif" CurrentDb.Execute "INSERT INTO Januari (bla..bla..bla..) End if
2. This my not working code:
If Me.txtidborang.Tag & "" = "" = (DLookup("NoGerankod", "HutangKeseluruhan", "NoGerankod='" & Me.txtnogeran & "'")) Then MsgBox "Grant Number Invalid", vbOKOnly Me.[cbostatuspembayaran] = "Geran Negatif" If Me.txtidborang.Tag & "" = "" = (DLookup("NoMatrikkod", "HutangKeseluruhan", "NoMatrikkod='" & Me.txtukmper & "'")) Then MsgBox "This Student still have debt ", vbOKOnly Me.[cbostatuspembayaran] = "Geran Aktif"
CurrentDb.Execute "INSERT INTO Januari (bla..bla..bla..)
End if End if
Q: How can i combine two dlookup together for different msg box?
I've got a continuous form, with a button (cmd1) on each record. Each record has a unique primary key, RecordID. cmd1 is clicked to open a form (frm1) based on the RecordID using the following code:
I have 3 peices of data that I am working with: Group number, plans and benefit elections. On my form I have fields for the group number and plan and 2 queries. When I enter a group number the first query displays a list of plan descriptions for that group. From there I can enter the plan description into the form's plan field and that runs the second query to give me a list of valid elections for that plan. This all works fine but I want to make the plan selection a little less tedious. What I would like is to be able to double click the query field housing the plan description and have it copied to the form's plan field. I could use the ID instead of the plan description but I work in a production environment and very key stroke counts so I would really like to have a simple double click process.
Is this even possible? If so how would I set that up? I tried using the double click on event macro builder but it does not seem to have this kind of option.
My form contains fields for group number and Plan. The same form houses 2 querys, one that pulls plans based on the group number and the other to pull elections based on the plan field (not the plan query). Would like to double click a plan within the plan query and have that description populated into the form's plan field.
Apologies, this was posted as a reply to a previous thread I submitted but its not related to the title anymore (dlookups).
I have a query that looks up a payrate value for an employee in a payrate table. It uses the appropriate value to determine the pay rate at teh time an employee has worked (DateWorked). On top of this I also need to introduce a parameter criteria on the DateWorked to allow the user to run the report for a time frame. This is where I get stuck as I cant seem to get it to work properly if I introduce another criteria on the field
The query that works great (without the second criteria) is as follows;
SELECT tblTimeCard.EmployeeId, tblTimeCard.TimeCardId, tblTimeCardHours.Task, tblTimeCardHours.Hours, tblTimeCard.DateWorked, tblPayRates.DateFrom, tblPayRates.DateTo, tblPayRates.PayRate, tblTimeCardHours.Hours*tblPayRates.PayRate AS Cost FROM (tblTimeCard INNER JOIN tblTimeCardHours ON tblTimeCard.TimeCardId = tblTimeCardHours.TimeCardId) INNER JOIN tblPayRates ON tblTimeCard.EmployeeId = tblPayRates.EmployeeId WHERE tblTimeCard.DateWorked Between [tblPayRates].[DateFrom] And [tblPayRates].[DateTo];
This is where I need to introduce another criteria where tbl.TimeCard.DateWorked Between [Enter Date From] And[Enter Date To]
when I try this I must have one of the joins wrong as I get all the payrate values for each date worked even if they are outside the dateworked criteria set by the second criteria.. I hope I have explianed this ok. Can someone please advise where I should be looking - many thanks
Is there any way in which I can automate a query (or update table query) to find the next date stamp that always starts with 'DATE', and put a double return in before it (so it starts on a new line with a spare line between). This is a table with 2 fields in it, the first being a Customer Reference number, and the second being a memo field, and some of the details and dates are quite vast. As an example the following text that is currently being displayed in the memo field would be displayed as the section below.
From this:- DATE: 13/11/2007 TIME: 2:24 PM:went to pay with CC DATE: 09/10/2006 TIME: 3:41 PM:Sent Invoice to Scott DATE: 10/10/2005 TIME: 10:22 AM:Email follow up to obtain feedback DATE: 25/10/1999 TIME: 11:18 AM:Received all documentation
To this:- DATE: 13/11/2007 TIME: 2:24 PM:went to pay with CC
DATE: 09/10/2006 TIME: 3:41 PM:Sent Invoice to Scott
DATE: 10/10/2005 TIME: 10:22 AM:Email follow up to obtain feedback
DATE: 25/10/1999 TIME: 11:18 AM:Received all documentation
On an existing DB i have set a default value for a field. The customer has now asked that they be able to change this default. I thought, hey, no big problem. They have SuperUsers, so i included a little pop up form that lists all the current valid values for that field (from a look up table). If the default value needs to change a superuser can access this and select the new default. That works fine. The trouble comes when setting the default value on a form.
I figured a simple bit of VBA in the OnOpen event - Me.cmbTypes.Value = Me.cmbTypes.DefaultValue - should work. However the value it returns from the default is ""xxxx"" and as such it is read as "". I can work around it by removing the extra " " but WHY does it do this? Would it be better to set this up as a custom property of the DB?
I need created a form frmFlight this form has two fields called DEP and ARR what I need is when the users types the 3 letter code in the DEP or ARR field if these do not match the any records in field AirportCode in the table tblAirport will highlite a error. Also I need to double click on the field DEP or ARR in the frmFlight and open the frmAirport with the specific record. Example if one of the records contain LCY by double clicking it will open the form frmAirport displaying the LCY record.
Is it possible to set a double input mask for a field? I would to set it so users can eneter two different values for data field: 00/00/0000 or just the year 0000, is it possible? How do I do that?
For some reason I cannot enter decimal values without the number rounding up or down. I've already set it to 'Number' and 'double' and have also tried 'Fixed' set to 2 decimal places. Right now the only way it works is if I set it to 'Text'. However I need to do some calculations with these values eventually.
What's strange is I have another table in the same database that is NOT rounding and is working just fine.
I have a form that utilizes a combo box with 2 options: 0 & 0.5. If I select 0.5 on the combo box the field in the table records it as 2. Why doesn't it reflect as 0.5? And how do I fix it?
This is the general info that I have for the field properties:
Field Size - Double Decimal Places - 1 Default Value - 0
I have recently upgraded my Access 2003 application to Access 2010. I am running into a problem when formatting a textbox to 'Long Time' that is linked to a Double type field. The error that I get is 'The value you entered isn't valid for this field. You may have entered text in a numeric field or a number that is larger than the FieldSize setting permits.'
The textbox is linked to a field (double data type) and displays as the time in long format (4:06:17 PM). When I try to change to 4:07:17 PM I get the error. I tried removing the 'PM' and the colons but the error still occurs. The only way that I can get it to work is if I use a double value (0.735405092592593). In Access 2003 the time value would display properly, allow me to change the time and then save the time as a double to the database.
I know how to do an action on doubleclick or mouseover but I want some simple text to come up, possibly with a white background behind it that has some details about the specific production number that the user is clicking on. Is there something like this? I tried a dialog but it brings up an ugly form, I just want the text or something simple. Can this be done?
Hi Something that has been bothering me is when I click tab to move the cursor to the next field on a form it goes into a field that is not the next one :eek: (if that makes sense). I think this is because I rearranged the fields. I dont want to rearrange them back. How :confused: would I be able to set Access so when I press tab it goes into the next field.
I wish to place a command button next to a specific field which when clicked, launches the search command ready to search records against that field.
I have already tried this and managed to place a button to search - however, this searches every field in every record - I just want to search 1 specific field.
I am a bit new to this, so please be as untechy as possible!
I have searched the forums and tried various options but I get an error message about the syntax.
The button is to run a SQL query to update a field by calculating on the value of a another field on the form. The query is DoCmd.RunSQL "UPDATE BatchPayments SET BatchPayments.[GST Amount] = (BatchPayments.[Net Amount]*0.1) WHERE BatchPayments.BatchPaymentsID=" & Me.BatchPaymentsID&";"
The error message is a compile error where it is expecting a list separator or ).
I've got to copy the value of field A so it appears in field B. Field B may be changed, but field A cannot be changed. What's the best code to put into my button to copy the value of field A into field B.
I'm trying to include a field in a form by putting the form in the design view, however, when I try to press the button 'Add Existing Field' or 'Property Sheet' in the Tools group Access doesn't do anything.
I have tried to search on the web for possible solution but I haven't found one yet but I did read about disabling the shift-key feature which may have something to do with it.
On an access 2010 form if there are 5 fields (Number,Address,Gender,Age,Date). Is it possible to use a button to export 3 fields (Number,Age,Date) to an excel spreadsheet (Master) and place them in a specific worksheet (Info)?
I got a form with a field called [copies on hand] so i made a command button and when i click the button, i want the value in the field [copies on hand] to be subtracted by one.....
The code i have thats not working is
Private Sub Command 25_Click() If [copies_on_hand] >0 Then [copies_on_hand] = ([copies_on_hand]-1) End Sub
We have an old laptop running XP.I have an old Access 2000 disc which I no longer use, and this has been loaded to that machine.I am trying to build a very simple database to keep track of the members hours.The table name is Main_Table, the fields are; [ID],[Name].[Hours].A form exists Sign In.On the Form,Sign In I need a Combo Box or List Box to select a record (name) then a command button which adds 2 hours to the number of hours already in the [Hours] field of that selected record, simple as that.I cant get anything to run
I am one of the guys that the dept. drops 1k to send to the beginner through expert level courses for Access, so I ask patience as I am new to VB coding.
I am working on a database to track patient surgical information. I am using a toggle button to control "patient surgery site" visibility, depending on the number of sites associated with them. They are labeled Site A Site B, Site C
What I want is if a patient only has one site, I press the appropriate toggle (Site_A_Button, Site_C_Button, and Site_C_Button) and only fields pertaining to Site A appear. If they have 2 sites, I can press both of the toggles for A and B, but the C will remain hidden, etc.
Each toggle controls 3 fields - For the Site A button - Site_A, Diagnosis_A, A_Blocks_Check For the Site B button - Site_B, Diagnosis_B, B_Blocks_Check For the Site C button - Site_C, Diagnosis_C, C_Blocks_Check
The *_Blocks_Check also controls visibility for a respective fourth field - Site_A_Blocks , Site_B_Blocks , Site_C_Blocks
So far, I have A and B working just fine. By default, the toggle for A is set to -1 so it is visible by default. Site B and C are default 0. Both A and B work exactly as I want them to, however, site C does NOT. It has identical coding as B, however, it is visible by default (despite the "default 0") and the Site_C_Blocks visibility (controlled by the Check Box) also does not work properly. Here is the VB-
Private Sub A_Blocks_Check_Click() If A_Blocks_Check = 0 Then Site_A_Blocks.Visible = False End If
If A_Blocks_Check = -1 Then Site_A_Blocks.Visible = True End If End Sub
Private Sub B_Blocks_Check_Click() If B_Blocks_Check = 0 Then Site_B_Blocks.Visible = False End If
If B_Blocks_Check = -1 Then Site_B_Blocks.Visible = True End If End Sub
Private Sub C_Blocks_Check_Click() If C_Blocks_Check = 0 Then Site_C_Blocks.Visible = False End If
If C_Blocks_Check = -1 Then Site_C_Blocks.Visible = True End If End Sub
Private Sub Site_A_Button_Click() If Site_A_Button = -1 Then Site_A.Visible = True End If If Site_A_Button = -1 Then Diagnosis_A.Visible = True End If If Site_A_Button = -1 Then A_Blocks_Check.Visible = True End If
If Site_A_Button = 0 Then Site_A.Visible = False End If If Site_A_Button = 0 Then Diagnosis_A.Visible = False End If If Site_A_Button = 0 Then A_Blocks_Check.Visible = False End If
End Sub
Private Sub Site_B_Button_Click() If Site_B_Button = 0 Then Site_B.Visible = False End If If Site_B_Button = 0 Then Diagnosis_B.Visible = False End If If Site_B_Button = 0 Then B_Blocks_Check.Visible = False End If
If Site_B_Button = -1 Then Site_B.Visible = True End If If Site_B_Button = -1 Then Diagnosis_B.Visible = True End If If Site_B_Button = -1 Then B_Blocks_Check.Visible = True End If End Sub
Private Sub Site_C_Button_Click() If Site_C_Button = 0 Then Site_C.Visible = False End If If Site_C_Button = 0 Then Diagnosis_C.Visible = False End If If Site_C_Button = 0 Then C_Blocks_Check.Visible = False End If
If Site_C_Button = -1 Then Site_C.Visible = True End If If Site_C_Button = -1 Then Diagnosis_C.Visible = True End If If Site_C_Button = -1 Then C_Blocks_Check.Visible = True End If End Sub
Now I know this is probably sloppy coding, but it was the only way I could get this to work properly at all, so feel free to critique as well.
I want to actually add additional sites (Site D and Site E), but not until I can figure out why the problem is with just A B and C.
I apologize if this seems a bit confusing, but if anyone could help out, I would be most appreciative!
I have a form which lists Employees (flds EmployeeID (pk), Surname etc.) and a form listing Absences (flds AbsenceID(pk), EmployeeID(fk), StartDate...etc.).
from the employee form, I want to use a command button that will take me to the Abscences form but auto insert the EmployeeID and then I can fill out the rest.
I tried the go to form command for the button but its only looking for existing absences with that ID?