Quantcast
Channel: Access for Developers forum
Viewing all 14673 articles
Browse latest View live

Relationships, Lookups and Cascading deletes

$
0
0

I have a table (TableA) in the database with a field e.g. XcompanyID that is defined with a lookup against another table (TableC) with companyID and companyName.

XcompanyID is unique in TableA.

I open the table in datasheet view and sort it on the XCompanyID field.  This apparently automatically adds an Order By (Lookup_XCompanyID.CompanyName) to the table that is now executed everytime I open the table in datasheet view.

The problem is that if I now delete a record from TableA it also deletes the lookup record from TableC (after the usual prompt about cascading deletions).

There are no relationships defined between the tables (And I did Show All in the relationships window).

Any idea what is causing this?  Thanks.


Passing dynamic parameter to a query in Access Web App

$
0
0

Hi,

I am very new to using MS Access Web App for SharePoint  and I am building few tables in it.

I am facing issue in fetching dynamic data from different tables.

For Eg., Table A, B, C have same column like Year and Month, and the tables are not related to one another.

I need to fetch TableA.Col1,TableB.Col1,TableC.Col1 where TableA.Year=[ParameterYear] and TableA.Month=[ParameterMonth] and TableB.Year=[ParameterYear] and TableB.Month=[ParameterMonth] and TableC.Year=[ParameterYear] and TableC.Month=[ParameterMonth]

For this i have built the query with parameters. But I dont know how to pass parameter year and month during runtime and how to achieve it.

Immediate help required.

Thanks in Advance.

Krish...

Deleted contents are not being moved away from Access Web database memory.

$
0
0

Hi All.

I have been asked to build a web database in MS access and am running into lot of problems now.

1. I used Project web database template by modifying its structures and also deleted few of columns there.Now i am almost at the end of my project completion. When i tried to publish it to the share point, USysapplicationlog table shows me lot of compilation errors(Screenshot attached). But i have deleted those records from my database and i am wondering how do those records not vanish from the memory. I have thoroughly checked that none of the records shown in the 'USysapplicationlog' are present in my existing web database. Could someone help me understand what error am i committing here?

2. I need to use 2 combo box namely Employee and Month. My web database has data for several employees for last 12 months. So one employee can occur 12 times.. I have been able to use set filter along with set tempvar macro commands to achieve this. However it is not working as i intended. My questions are below. 

a. I need to show only the unique records taken from my access table in my  Employee Combo box but when i searched the forum i read that DISTINCT and GROUP BY is not supported in access web database. Similarly withMonth combo box. It has to show only 12 months. But my table has duplicated records for month column as well.. Please help me how to achieve this. 

b. Secondly the above one is Month combo box which i can use to filter the respective month data. I also have another combo box namely 'employee'. when i try to filter the Employee using second combo box, the first Month combo box would be unfiltered. What it means I need the data for an employee for the month of Jan but i can use only one combo box at a time. Either one combo box would be unfiltered when i try to use both.

I greatly appreciate your response on this. 


Santhosh

occasional #Type! error

$
0
0

Access 2010.accdb just fyi     split front/back  about 6 full time users....

The app occasionally but regularly throws #Type! errors into form text boxes.  Trouble shooting seems to indicate latency caused in that it does not occur ever when front/back are on same PC or tested on another network of just 1 segment (front/back PC connected to same router).  No wireless is involved.

The main screen form is complex, but I believe correctly designed.  It has a continuous sub form with a few columns summed.  The sub form sum is used in math in the main form - and the users have a need to see values from other tables so there are textboxes with DlookUps sourced on fairly complex queries - which also are involved in math in the main form.

This main screen has a button to open a report object.  This report, which is a summary primarily used for printing, has fields that sum math fields from the main screen.

i.e. =Forms!MainScreen.Text1 + Forms!MainScreen.Text2

The #Type! error, which is intermittent is typically seen in the report.  But it does happen in the form sometimes.  As noted above - if the network is taken out of the picture it never happens.  Users can often close/reopen and then it works ok.  Not seeing signs of corruption - again everything works fine depending on the deployment as explained.

I have considered eliminating any calculated fields in the report, by creating a fairly complex query record source for it - - but before going down that road would welcome some experienced advice - as the latency issue may affect it regardless.

The IT folks are being called it to see what improvements they can do to the latency situation as that is where the arrow points at the moment. My theory at the moment is that due to changing latency (random network speed changes) - sometimes the report or form object is opening without all the data being available and that is why the error gets thrown.  Part of the reason for thinking this is that the user has asked for more and more calculations with each version - and the issue just is now surfacing and I wonder if there is a 'straw breaking the camel's back' issue in terms of extended processing caused delays...... Is this plausible?

Using =substitute() in a query SOLVED

$
0
0

Is it possible to use that in a query?

The reason I ask is because my data is coming from china and for whatever reason half of their data is using "non-break space". Maybe they are using non-standard keyboads?

I want to do something like substitute([column],chr(194) & char(160),char(32))


Access VBA Random Sample Question

$
0
0

Hello,

I have a form (frmRandomSampling) where the user selects how many Sample (txtSample) they would like to run. Then they select "Run Report". 

Table below (tblEmployeeProduction) indicates "Employee ID” and “Item Number”

This is the coding that I am using, it will pull proper sample for the department but not for each employee for that department. Let say the user select 2 sample it will pull 2 samples for the department instead of 2 samples for each employee with in that department.

I am not a programmer, can you help with the coding?

Thank you and have a good day!



Private Sub BuildRandomTable()
Dim dbsRandom       As Database
Dim rstRequest      As Recordset
Dim rstRandom       As Recordset
Dim UpperLimit      As Long
Dim LowerLimit      As Long
Dim lngCounter      As Long
Dim lngGuess        As Long
Dim lngRequest      As Long
Dim lngRecordCount  As Long

' This module is in the Current database.
Set dbsRandom = CurrentDb

' Open table recordset.
Set rstRequest = dbsRandom.OpenRecordset("tblEmployeeProduction")
rstRequest.MoveFirst
LowerLimit = rstRequest!ID
rstRequest.MoveLast
UpperLimit = rstRequest!ID
lngRecordCount = rstRequest.RecordCount

' Build Random table

Set rstRandom = dbsRandom.OpenRecordset("tblRandom", dbOpenDynaset)
lngCounter = 1

' Check to make sure the number of
' records requested is reasonable.
If lngRequest > lngRecordCount Then
    MsgBox "Request is greater than the total number of records."
Exit Sub
Else
    'lngRequest = lngRequest + 1
    lngRequest = Form_frmRandomSampling.txtSample + 1
End If

Randomize

    Do Until lngCounter = lngRequest
        ' Generate a random number
        lngGuess = Int((UpperLimit - LowerLimit + 1) * Rnd + LowerLimit)
        ' Ensure that it exists in the Orders table.
        rstRequest.Index = "PrimaryKey"
        rstRequest.Seek "=", lngGuess
            If rstRequest.NoMatch Then
            ' Drop through and generate a new number.
            Else
            ' Check to see if it's already been used in the new table.
            rstRandom.FindFirst "lngOrderNumber =" & lngGuess
                ' If not, add it to the new table.
                If rstRandom.NoMatch Then
                With rstRandom
                .AddNew
                !lngGuessNumber = lngCounter
                !lngOrderNumber = lngGuess
                .Update
                End With
            lngCounter = lngCounter + 1
            End If
        End If
    Loop
    ' Clean up.
    dbsRandom.Close

End Sub


Jay






Checking for duplicates in a SharePoint list

$
0
0

After advice here, I have adopted a hybrid approach to the database we use to track children's progress (using annotated photographs) in our school. The "working" database is actually pretty simple only requiring one table to be updated each week. That is the table that I have converted into a SharePoint list and linked to in the front end. However, exporting it to SharePoint removes the primary key (consisting of two fields) and inserts an autonumber key. As a result, I have to check for duplicates as each record is saved. Not being all that clever at Access stuff, I do this via a duplicates query. I allow the record to be saved, run the query, count the number of records returned, trap error 3021, and, if a duplicate appears, delete it.

Is there anything desperately wrong with this approach?

Best - Anthony

Best way to connect Access with Quickbooks

$
0
0

Can anybody recommend what the best way to connect my DB with quickbooks would be? Its basic acounting data that I want to be exported into quickbooks so that the data doesn't have to be entered once in access and again in QB.

I've been told that there is either IIF or QODBC. Can anybody weigh in?


Access Qry Criteria

$
0
0

I am trying enter criteria that will enable me to pull data from October of the previous year to today's date. I don't want to have to go into design view each year to enter new criteria. I created the below but it isn't working:

Between Date( ) And Year([TRAINING DT]) = Year(Date()) - 1 And DatePart("m", [TRAINING DT] = 10)

Please help

previous employee left the app but i cant see the code

$
0
0

Hi.  One of our users has an mdb file on her pc.  When she shortcuts to it after logging in with her credentials, she sees an app that allows her to view and update various attributes related to agencies we deal with.   We know its really a pass thru to sql server and would be surprised to see it using access to store anything but metadata like views etc.

In the bottom right when I remote to it or she runs it we see something like "powered by access".  Upper left we see a view name that looks something like vw_agency...

I haven't worked in access for a long time and am not even sure I could answer this question if I had.

I'd like to see the sql code etc behind this app.  Specifically how it distinguishes agencies that are subsidiaries from ones that aren't etc. 

We looked to see if access is installed (under office) and don't see it installed on her machine, but maybe we are mistaken.

How can I see the code behind the app?  In what she sees there are none of the things I expect a developer would see like tables, views etc.   if I switch users from her to an admin might I see more?  If a connector file needs to accompany the mdb file to a pc where we have access installed, how can I know where and what that file is?

how to get a listbox item into db table

$
0
0

Hello.  I have hit a wall on this.  I have a listbox on a form which is a list of names only, no PK or anything else beyond the names.  When I select a name or names from the list I then use a SAVE button to take the selected name(s) and the meeting id number of the form and place into a db table, which is a SQL Server linked table.  It is the VALUES section of the INSERT INTO statement that is making me hit a wall.  

Can someone set me straight on this?

Thanks...John


Access and Sharepoint : Authentication problem

$
0
0

Hi Microsoft,

It looks like your Access 2010 and 2013 applications are having some issues when they trying to authenticate access to a sharepoint site. Access just freezes when it should connect to the site have to force close every time.

Is there any solution?

Urgently needed as my team depends on an Access db for daily business!

access web app filter combobox by query and a var

$
0
0

Hi,

How can i selected records in a combobox based on a query and a var?

Query's that have a var does not showed in the list source, why?

In the desktop access you can make a global var and use it in any query you like. Must i set any parameters? But where can i set them? Must i set them in the form somewhere?

Thanks!

get X and Y values of scatter plot points

$
0
0

I created a scatter plot in Access form, and I would like to change the dot color based on a third column. I used the following code, but it seems that the order of the points is different from the order of records in the datasheet. The dots are colored wrongly. How can I find the X and Y values of the points? I tried to use objChart.SeriesColelction(1).values (or xvalue), it didn't seem to exist.

    Dim objChart As Chart
    Dim objSheet As Object
    Set objChart = Me.chtPerf.Object.Application.Chart
    Set objSheet = Me.chtPerf.Object.Application.DataSheet

    For i = 1 To objChart.SeriesCollection(1).Points.Count        
        If objSheet.Cells(i + 1, 3).Value = "Yellow" Then
            objChart.SeriesCollection(1).Points(i).MarkerBackgroundColorIndex = 6
        End If
        If objSheet.Cells(i + 1, 3).Value = "Green" Then
            objChart.SeriesCollection(1).Points(i).MarkerBackgroundColorIndex = 4
        End If
        If objSheet.Cells(i + 1, 3).Value = "Red" Then
            objChart.SeriesCollection(1).Points(i).MarkerBackgroundColorIndex = 3
        End If
    Next
    Set objChart = Nothing
    Set objSheet = Nothing

AddContactFromOutllook macro and Embedded Macro Question

$
0
0

Hi,

I am integrating the AddContactFromOutlook macro (used in the Northwind database) into my application.  The macro is executed in an embedded macro.  After the AddContactFromOutlook is executed, I would like to update a field on the Contact record that was just added.  Is there a macro that I can execute that would allow me to update the Contact record. 

Embedded macros are confusing!

smsemail   


use "if" to show msgbox and end the process

$
0
0

hi:

i used this code to delete duplicate records

now i want to put a msgbox and end the process if is true. pls dont ask why i did it in this way

Private Sub Form_Close()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = Application.CurrentDb
Set rs = db.OpenRecordset("qry_Duplicates")


Do Until rs.EOF
rs.MoveFirst
rs.Delete
rs.Close
Set rs = Nothing
Set rs = db.OpenRecordset("qry_Duplicates")
Loop 'what i need' If rs.EOF Then 
Else: MsgBox "bla,bla": End



End Sub


Data type mismatch with DAO SQL [SOLVED]

$
0
0

This is beyond me.  I've never had a simple statement fail.

Set diag = db.OpenRecordset("SELECT * FROM diag WHERE when ='" & lastFail & "'")

lastFail is a Date type variable. 

when is a date field



Help with the structure of a database ERD

$
0
0

I am requesting your assistance for some help with my Microsoft Access database relationship structure. I am working for a project for a mining company which has mine sites worldwide. One of the areas of business is insurance, and this insurance is provided to the various mining operations. The mining company employ the services of a broker to bill some of the clients and to reinsure insurance premiums. So the process is: on an annual basis, the mining company will pay the insurance premiums and fees the to the broker, on behalf of the mine sites, in order to insure the operations of the mine sites. The mining
company will then prepare invoices and bill some of the mine sites to reimburse mining company for insurance premiums and admin fees. Some of the mine sites, which are not billed by the mining company, are billed by the broker. The broker will in turn the mining sites. The mining sites will pay the broker and the broker will in turn pay the mining company. The broker has broker agencies in some of the countries where the mine sites operate, so some of the mine sites will
pay the broker agencies who will in turn pay the mining company. The invoices are broken down into (i) insurance premiums and (ii admin fees. The mining company will invoice some of the mines directly for both the insurance premiums and admin fees. However, in some instances, we billed the broker agency for the insurance premiums and then the mining company bill the mine site for the admin fees.

Originally when I had setup the database, I had grouped the Broker in my Client table (denoted by tblClient).

I have added a broker table (tblbroker) and an address table (tblAddress) I tried to link it to the client table but when I run a query no results appear. I am not sure what I am doing wrong.


Access functions to match two address text field

$
0
0
Would like to ask for access functions that match two addresses to certain degree of similarity.  Thanks

Access 2010 (data)macro exception: "CreateRecord cannot be used inside of a ForEachRecord."

$
0
0

Hi all,

We have a technical issue related to (data)macros in Access 2010. During iteration of records via data block method "ForEachRecord" (data is a record result set via web query) we get the following exception when inserting rows during the same iteration (of ForEachRecord) in another table by using data block method "CreateRecord":

 "CreateRecord cannot be used inside of a ForEachRecord."

Does anybody know what the reason is for this issue? If inserting rows via CreateRecord is not allowed during a ForEachRecord by macro design, what is the alternative to insert data in another table when using a ForEachRecord?

All solutions, work arounds or ideas are welcome!

Best regards,

Coen Mooijman

Viewing all 14673 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>