I have 3 queries that pull from 3 dfferent tables. All 3 tables contain a field called Acct but the other fields in the 3 tables are different. What I would like is to have a form field that the user can input an account number and depending on which query the account number is in, that query and result will display. I have been trying the dlookup function but can't seem to get the coding down. Also, if the account number is not in any query I would like a message box to display saying it can't be found. Thanks for any help!
I have 3 queries that pull from 3 dfferent tables. All 3 tables contain a field called Acct but the other fields in the 3 tables are different. What I would like is to have a form field that the user can input an account number and depending on which query the account number is in, that query and result will display. I have been trying the dlookup function but can't seem to get the coding down. Also, if the account number is not in any query I would like a message box to display saying it can't be found. Thanks for any help!
I have 3 queries that pull from 3 dfferent tables. All 3 tables contain a field called Acct but the other fields in the 3 tables are different. What I would like is to have a form field that the user can input an account number and depending on which query the account number is in, that query and result will display. I have been trying the dlookup function but can't seem to get the coding down. Also, if the account number is not in any query I would like a message box to display saying it can't be found. Thanks for any help!
I have a database with 3 tables. Each table has an account number field however the tables are completely different as are the account numbers that populate them. To go with the tables are queries that will bring in desired information. What i would like is for the user to input an account number on a form and have some code in the background that will find the account number in the table it is in and open the corresponding query. Is this possible? Thanks for the help. I have been trying to write code with DLookup but can't seem to get it to do what I want.
I'm trying to limit the records on a subform via an option group selection. The group has 2 options: optionTrue (option value = 1) and optionFalse (optio value = 2). I have the following code in my query criteria of the true/false field.
IIf([Forms]![FrmHome]![frameProcessed]=1,-1,0)
The false part works, but the true part doesn't. I've tried many variations using true/false, using checkboxes, etc. and nothing works.
The database is SQL Server if that matters.
Any suggestions?
Also, is their a way to have an option for True or False or ALL?
Hi, I have Add button. When i click on the button, it will open frmstaff for me to enter new staff record. Now, i have to set DataEntry=True. It means i have 2 forms, one for data entry and another form to view previous staff records. Is it possible for me to do like this?
Private Sub cmdAdd_Click() Set Forms("frmstaff").DataEntry = True End Sub
but it will give me error, Invalid use of property.
I was reading how to make a a button open a webpage. I found out how to and what to type in the Visual Basics. It worked but like another user said, when ever he clicks the button, the window opens for the website but the window is not maximized. He said "I set the open new window value to True".
I export a query as csv to upload to another database on a web site. When that csv file has been exported I'd like the query to be emptied, so that the next time I export I don't export duplicates. What's the easiest way to do that?
I've been thinking of having a field in the table with a check box that is checked when the file is exported. The query then selects only those records where that box is not checked.
But how can I check those boxes on Export rather than when I run the query? The reason being that I may want to preview by running the query, without having that affecting the check box.
I have a from which has a sub Form in it which uses a query of a table which is filtered, In the main form I want a sum of the data in the subform for a particular field if TRUE.
In the main form I have a text field with the Syntax =DSum("[Cost]","RepairInformation","[Labour] =.True."), but this returns an error, I have no issues for the total cost for with I have a Text Box in the subform which returns the Total cost in the main form.
What are my options to have a conditional sum for a particular condition.
In a form, the value of any field may determine if the other field will be true or false. For example in my form, inventory, if value in code is equal to 2 then the Field Table will be automatically false.
In access report, I'm trying to change color of text in specific records based on the true/false value in another record. Works in forms using conditional formatting, but won't seem to work in a report.
Here's what works in forms : IIf([2009 Symposium]=true, forecolor=255 ....this changes the records to red.
But using the same expression in a report doesn't change the text color.
I've recently finished constructing a database that uses forms with checkboxes i.e. when a user opens a form there are several checkboxes associated with labels, but the table only stores the check-boxes and the form labels are the field (column) names on the table.
Now, what I'm trying to do is create a search feature whereby if a keyword search is conducted, a search through the column names from the table with checkboxes takes place and only lines (rows) with true (checked) checkboxes are returned.
I have a query that shows banned users (I work in a school). When a student's ban has ended, a tick box is checked in a form linked to tblBannedUsers to show they are no longer banned.
The query itself simply queries all records in tblBannedUsers with a username field (UserID) taking search criteria from a box on a form.
However, I want to filter out the students that are no longer banned (those with a tick in the checkbox). To do this, I thought it would be a simple case of editing the query, and in the Ban Lifted field criteria, use =False to say I only want those records with a tick.
This doesn't work and I still get all records given the combo box filter (which are just filtering for a username...if I leave it blank it gives all records via Is Null).
What should I be putting in the criteria to filter out those records with a ticked checkbox?
Thanks,
Steve Swallow
EDIT: I've just done a test query and <B>No</B> is the criteria to use, but when I use this criteria in my query which also take data from a form's combo box it ignore the <B>No</No> criteria.
I need a help. I have one table that has a field called "Initial ZIP CODE", another field called "Final ZIP CODE", and a field called "AREA".
I have a data base that will give me the specific "ZIP CODE", that will be between the "Initial ZIP CODE" and "Final ZIP CODE", and I want to get the "AREA".
I'm really not sure how to go about this. I'm creating a course booking system and when creating a booking I need to check for current bookings with the same employee and course id's (i.e. the employee is already booked on the course). The query takes the employee and course id's from a form, and is initialised when the 'book' button is pressed. It correctly selects if the person is already booked on the course but I want the query to return a value to the form i.e. if it returns null/false then the booking can be created but if it returns a record/true then the booking already exists and a message box can be displayed.
I'm not sure if I'm going about this the right way, can anyone suggest how this can be done as described above or suggest a better way of doing the task?
I am trying to resolve an issue of being able to use a query from many different forms where the query is dependent on the date selected in the current open form. Right now it calls the function getDate() which works fine. Unfortunatly the function is called before the form is fully loaded and the control I want to pass has no value/doesn't exist yet and I get a "Runtime error 13 Type-Mismatch"
Here is the function code:
Function getDate() As String
If fIsLoaded("F_SupplierData") Then getDate = Form_F_SupplierData.txtDate Else getDate = "01/01/1901" End If
End Function
Function fIsLoaded(ByVal strFormName As String) As Integer 'Returns a 0 if form is not open or a -1 if Open If SysCmd(acSysCmdGetObjectState, acForm, strFormName) <> 0 Then If Forms(strFormName).CurrentView <> 0 Then fIsLoaded = True End If End If End Function
Is there a way to detect the state of the text field itself (if it is open, closed, dirty)? Or if anyone has a better way to tie a query to multiple forms?
I have a table that holds the SQL texts for ca. 1000 Select queries (mostly minor variants that are used to programmatically swap out RowSource strings for combo boxes). I'd like to have a quick and easy way to open/review/modify these queries.
One strategy would be to display the SQL strings in a field on a Datasheet form, then use an onClick event on a text box linked to the SQL-holding field (or perhaps an onClick event tied to an unbound text box on the form) to open the associated query. That would allow me to view the SQL of the query that I want to open, allow me to quickly scroll through the list of stored SQL texts, and give me options for sorting or limiting the SQL-texts displayed in the datasheet form.
But, I can't seem to get the onClick event to work. The problem seems to be that I can't figure out how to pass the SQL string contained in the field to a function that will use that string to open the query .
I'm calling this code on my Form's BeforeUpdate Event which I understand should only run if the form is dirty. In this example, the code should check to see if 4 fields ("txtField1", "txtField2", txtField3", "txtField4") have data present, if not highlight them yellow.
Function Msg() Dim ctl As Control Dim strFields As String Dim strControl As String Dim intCounter As Integer Dim blnEmpty As Boolean
For Each ctl In Me.Controls blnEmpty = False If ctl.ControlType = acComboBox Or acTextBox Then If ctl.Visible And Len(ctl.Tag) > 0 Then Select Case ctl.Tag Case "txtField1", "txtField2", txtField3", "txtField4" If IsNull(ctl.Value) Then blnEmpty = True ctl.BackColor = vbYellow Else ctl.BackColor = vbWhite End If Case Else If ctl.Value = 0 Then blnEmpty = True ctl.BackColor = vbYellow Else ctl.BackColor = vbWhite End If End Select If blnEmpty Then _ strFields = strFields & ctl.Tag & vbCrLf If blnEmpty Then _ If Len(strControl) = 0 Then _ strControl = ctl.Name End If End If Next
If Len(strFields) > 0 Then Cancel = True MsgBox "You have not completed all data fields, " & _ "please enter data in the following fields:" & vbCrLf & strFields, _ vbExclamation, Me.Caption Me(strControl).SetFocus Me(strControl).BackColor = vbWhite Exit Function End If End Function
However, it keeps falling over at: Cancel = True saying "Compile Error: Variable Not Defined"
I want to be able to run this code from a "Close Form button" to ensure that either the record is not created unless the fields listed are filled in or the form closure is cancelled so that the user can complete the missing data.
I've seen varients of this code on a couple of Access forums but can't find a solution for the "Cancel = True" issue.
The above formula works as is in the field I have it in, but need it performed only if [Label5] is marked yes. I guess what I need is what goes in front of the above formula. I've looked through the forum, but it is so huge I had no luck finding what I needed.
If [Label5] is no, I need it to go to [Label6] and if [Label6] is yes, perform another calc like the one above. If [Lable6] is no, I need an error message.
Hope this is clear. Any help is greatly appreciated.
Hi all very simple question i'm sure but had a look through the forums and couldn't find anything.
On a form i have 2 buttons, one for new data and one for editing data. When either of these buttons are clicked a few text boxes pop up and immediately display data (The first record of the recordset). For the edit button this fine, however how do i get the text boxes to display a new record and not allow the user to head backwards through the recordset only onto a new record??