I have a query in Access 2000 that I can't get to force a certain value in empty rows for a particular field column - maybe someone here can see why?
The SQL for the query is as follows (give or take some)...:
TRANSFORM Count([Testing DB].[DB_ID]) AS [CountOfDB_ID]
SELECT [Testing DB].State, [Location].[North], Count([Testing DB].[DB_ID]) AS [Total Of DB_ID]
FROM [Testing DB] LEFT JOIN [Location] ON [Testing DB].[Address] = [Location].Address
WHERE ((([Location].[Size])=Nz([Size],"Big")) AND (([Testing DB].[Window Length]) Is Not Null)
GROUP BY [Testing DB].State, [Location].[Size]
ORDER BY [Testing DB].State, [Location].[Size]
PIVOT Format([Date],"mmm-yyyy");
I want my crosstab to end up so that any records in the "Size" column that are not matched between the two tables, and therefore come up empty for those rows in the query results, are forced to change from empty to "Big" - so that they can be added into the count of "Big" hits that the query ends up with in the "Size" column. But all my "nz" addition did was remove the columns with blank values from the crosstab - no addition to the "Big" counts.
Am I perhaps going about this incorrectly? Maybe I should have used some form of iif(is null) instead.:confused: Any help is, as always, much appreciated.
I am using Access 2003. Access front end, sybase backend. I am building the queries in the design mode in Access. Here is my question...
I am looking for a way to force a one-to-many relationship between two tables. I am connecting the primary key in table1 to a field (foreign key) in table 2. But it keeps going to one-to-one. It should be doing one-to-many (the "1" and the "8"-sideways infinity symbol).
Being an amateur at Access, I've only recently realized that you can force column headings for crosstab queries, by typing those headings into the properties of the field selected as the column. But can you do the same for ROWS?
My data concerns patients of a specific type and the times of day they show up at our A&E (ER). I've grouped these by hour and now I want to crosstab them by day of week. But if there aren't any between say 3am and 5am, those hours don't show in the query, which is screwing up a pre-formatted report I have.
I've found some assistance on other threads..... http://www.access-programmers.co.uk/forums/showthread.php?t=92471 http://www.access-programmers.co.uk/forums/showthread.php?t=83820 .....but to be honest I didn't really follow it.
Is there an easy solution? If not, it's not a huge problem and I can "fudge" it once a month, offensive as that must sound to you professional types!
If the query returns no results, like it should, but I want to force a row with zeroes in it, can that be done? how? i have tried an if statment in all the fields to fill something in if the field is null but that didnt work. i tried using nz but that didnt work. any suggestions would be appreciated! Thanks!
I have a form on which I have a button that I want the user to click after a cetrain field on that form is updated. I display a little pop-up box saying to make sure that a user clicks on that button. Is there a way to know that this button was clicked? Is there a way to not proceed with anything else until that button is actually clicked?
Is there a way to force the size of a popup form? I want it to be around 3.5" by 4" because every time it popus up it is only around 2" by 1" and i have to resize it to look right.
I have a button that I click and it gets a value from my form and opens a query linked to a report, grabs the records, populates the report, and previews the report.
What I want to do now is Run the Query, dont show it, but print it to a deisignated Printer.
1. How can I run the report, not show it, but print it?
2. How can I force a print to a specific printer on my network?
It might be an easy one but I just wasted the past hour deciphering through my code in order to solve the run-time error '94' that I'm getting when trying to execute the following code:
Code: Private Sub cmdUpdateDates_Click() '################################### 'This sub aims at combining the timesheet date and the start and end time into the fields [Start Time] and [End Time]. '################################### Dim intCounter As Integer intCounter = 0 Dim rs As ADODB.Recordset
I download the database from this thread http://www.access-programmers.co.uk/forums/showthread.php?t=103278 and I copy the table, form, macro and module to my database but and error is appearing showing that missing shutdownform.
I don't know if it's possible, but is there any way of forcing the random autonumber generator in tables to be a positive number only?
The autonumber as I've searched on the forum can be a positive or negative number and I'd like to use the random autonumber feature as a primary key for account numbers for my database, but not using the negative numbers as they will look like odd account numbers with the leading negative.
I could possibly remove the leading negative, but there's then the chance that you'll have duplicates.
Is it possible to force the cursor to move to the start of a text box when it gets the focus? (I suppose what I am really asking here is, is it possible to force a 'Home' key event?)
There is a text entry box, which when people put the cursor into it, it sometimes sits part the way in, consequently the operator could end up trying to type in more information than there is available space. I know that education might go along way here, but you just can't teach some people.
How do I programmatically force an error dialog to make a certain choice?
I'm able to trap the dialog via the following code:
Private Sub Form_Error(DataErr As Integer, Response As Integer) If DataErr = 7787 Then 'record updated by another "user" (subform) MsgBox "Error trapped!" Response = acDataErrContinue Else Response = acDataErrDisplay End If End Sub
Problem is, if I bypass the 7787 error in this manner, it defaults to dropping the changes, rather than saving the record, which is what I want. (Both are choices on the dialog.)
This question seems so simple, I feel like the answer is right in front of me. However, I have no idea how to solve this problem.
Essentially, I have a field in a table (or data entry form in datasheet view) that looks up values from a different table. I want the user to only be able to use one of those values, not type in whatever he wants. How do I accomplish this?
Ive got a database with a combo box, called "combo1" (with 2 columns). It is unbound but uses a query as its row source. When i select a value in combo1 is places the data from combo1.column(1) into a textbox (text1). I then click the next record button (button1) and it then keeps the same value in combo1 because it is unbound. So i need it that when i go to the next record it displays the value in combo1 that relates to text1.
I write Access 2010 apps in VBA that require no knowledge of Microsoft Access on the part of the user. My forms contain all the necessary controls to use the program without relying on any of the Microsoft Access toolbars. I call this "de-Microsofting" the app. When I prepare the .accdb program to create a .accde app, I uncheck every checkbox (Options/Current Database) except "Compact on Close". This works well, but it also hides the Windows taskbar at the bottom of the screen. Some of my users need to be able to jump from my app to others (e.g., Excel) and back without having to exit my app. How can I force the Windows taxkbar to always be on top using VBA or, possibly, some setting?
I have an application that is using SQL Express as a backend and syncing to a SQL database through SQL web synchronization. This all works great and my clients have my custom application to interface with their local database and do work and it syncs back to the corporate database and I've got it scheduled to run in Windows every minute. What I would like to do is have a button or on event set of code that forces that sync pairing to run and I'm not exactly sure how to do that.
Access 2010 - In datasheet view, some of my yes/no fields display according to the format set in design view (yes/no, true/false, etc., or -1/0 if no format specified). But a few fields that I have added since originally creating the table show up as check boxes.
I cannot find any discussion of how to force the checkbox display or even figure out where that is specified. This same behavior carries over to DS forms as well.
How can I specify a checkbox display style instead of Yes/No etc?
I have a form which displays the values of a table Vehicles. It has a control at the bottom of the form that allows you to toggle through the records, or enter a specific number of a record for it to jump to. It starts at 1.
I want it to skip the first 3 records in the table, and start at number 4. Is there a simple way to do that?
I have a DB where I want text entry of the primary key to adhere to a certain format. I'm already using a mask of >LL000000 to force two capital letter and 6 numbers. Is there any way I can force extra restrictions, by making for example the first 3 characters to have to be AB1, thus making every entry follow format: AB1<number><number><number><number><number>
Hopefully there's someone who can help me with this!!! I've had several unsuccesfull attempts and don't know what else to try...
We're trying to force users to make entries in a field called txtComments in the frmQuestionnaire form if they provide negative responses and to stay on that record until the comments are changed. Inside the form is an option group (fraResponses) which contains options (OptA, OptB..etc.) valued from 1 through 7, based on a likert 7 scale. We're only using a likert 6 scale, so the respondents will only see 2-7 on the form. If they options B-D (valued 2-4), they are considered negative, so we want to make sure they enter a comment.
I tried to enter the italicized code under the form on BeforeUpdate, AfterUpdate, CmdUp (click to next question) and CmdDown (click to previous question), with frmQuestionnaire but nothing happens:
There is a module called clsUser which contains the following and where I tried to insert the code:
Set myForm = Forms!frmQuestionnaire ' ================================================== == ' First, set the value of the variables ' ================================================== == lngQuestion = arrQ(lngArray, 0) lngSession = GetCustomInfo("TestSession") lngUser = UserID lngBillet = BilletID
strComment = Nz(myForm.txtComment, "")
strComment = "None"
'If user selects negative responses If Form_frmQuestionnaire.fraResponses.OptionValue = 2 Or 3 Or 4 And strComment = "None" Then MsgBox "Please explain the problems you encountered with the system which " & _ "caused you to select an unfavorable response." Form_frmQuestionnaire.txtComment.SetFocus
End If
lngResponse = myForm.fraResponses
When I place the code there, the dialog box appears for all values and goes to the next record. This is what appears for the CmdUp (click to next question):
If cUser.blnDirty = False And Me.fraResponses = 153 (this is default value for the entire option group) And cUser.blnNew = True Then cUser.blnDirty = True End If
cUser.CaptureAnswer If cUser.lngArray < cUser.UBound_ArrQ() Then cUser.lngArray = cUser.lngArray + 1 Else cUser.lngArray = cUser.UBound_ArrQ() End If cUser.FillQuestions cUser.blnDirty = False
I've tried to enter the line of code with the form and the module, but no luck.
I also want it to remain on the same record until the field is changed. The form is unbound and has the following:
GetResponseSet lngRG FillAnswers If lngArray = 0 Then myForm.txtComment.SetFocus myForm.cmdDown.Enabled = False Else myForm.cmdDown.Enabled = True End If
If lngArray >= UBound(arrQ) Then myForm.txtComment.SetFocus myForm.cmdUp.Enabled = False Else myForm.cmdUp.Enabled = True End If End Sub
Public Sub FillAnswers() '************************************************* **** ' Purpose: Fill out the user's previous responses ' ' Assumptions: N/A ' ' Effects: N/A ' ' Inputs: ' None ' ' Returns: ' None '************************************************* ****
Dim strSQL As String Dim recAnswer As New ADODB.Recordset
If Not recAnswer.EOF Then myForm.fraResponses = recAnswer!reDatResponseSetID myForm.txtComment = recAnswer!reComment blnNew = False Else If myForm.fraResponses <> 152 Then myForm.fraResponses = 153 myForm.txtComment = "" blnNew = True End If End If
Is there any way to force the switchboard to maintain its pop up window size? Whenever I open an item from it that is maximised and then return to the switchboard it too has maximised.
I have a form that has a bunch of check boxes on it. The user selects specific check boxes My code then has a few If then statements to test which ones were selected. With each one that is selected a query is run to select specific records in a table. (querying out the values from an email field) The user then hits a button to send the email. Microsoft Outlook opens and the emails list is added to the "To" in the email.
Everything works great...But I have a slight issue. If a user has permissions on more than one account when they go to send an email they have the ability to choose a "From" (thus specifying which account to send from)
The user can currently select which one they want but I want this to be more automatic.
CAN i specify which account to send from automatically when the email opens. BUT Just for this application...
Does that Make any sense?
THanks in Advance
Code:Private Sub Command23_Click()' This section is Calling seperate Subs that verify if a Radio Button is selected' If selected it builds the string needed for the email.Call TestCheck3Call TestCheck5Call TestCheck7Call TestCheck9Call TestCheck11Call TestCheck13Call TestCheck15Call TestCheck17Call TestCheck19Call TestCheck21Call TestCheck24Call TestCheck26Call TestCheck39Call TestCheck41Call TestCheck43' This part concatenates the email string being build andDim FinalEmailString As StringFinalEmailString = ""FinalEmailString = Test03 + Test05 + Test07 + Test09 + Test11 + Test13 + Test15 + Test17 + Test19 + Test21 + Test24 + Test26 + Test39 + Test41 + Test43' THIS SECTION TESTS THE CONCANTENATED STRING TO SEE IF IT IS NULL' IT THEN GIVE THE USER THE CHOICE TO CONTINUE WITHOUT ADDING EMAIL' ADDRESSES OR TO STOP AND MAKE A SELECTION.If FinalEmailString = "" Then Answer = MsgBox("You must first select a Group to email, if you wish to continue without adding an email list just hit No", vbQuestion + vbYesNo, "???") If Answer = vbYes Then Exit Sub Else ' This part sends the string to the email and opens the email DoCmd.SendObject acSendNoObject, , , , , FinalEmailString, "Alert Group", , True End IfElse ' This part sends the string to the email and opens the email DoCmd.SendObject acSendNoObject, , , , , FinalEmailString, "Alert Group", , TrueEnd IfEnd Sub' EXAMPLE OF ONE OF THE QUERIES BASED ON THE CHECK BOXESPublic Sub TestCheck3()Test03 = ""If Check3 = True Then Dim dbs As Database Dim rs As DAO.Recordset Set dbs = CurrentDb Set rs = dbs.OpenRecordset("Select * From tbl_Business_Name WHERE TYPE = 'APARTMENTS'", dbOpenDynaset) Dim strTO3 As String strTO3 = "" Do Until rs.EOF strTO3 = rs!EMAIL & ";" rs.MoveNext Test03 = Test03 + strTO3 Loop rs.Close 'Close what you opened. Set rs = Nothing Set dbs = NothingEnd IfEnd Sub