Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all 13329 articles
Browse latest View live

Excluded results in query

$
0
0
It is kind of hard to explain.
This is my start

City result.png

I need to keep all of these fields but if you notice there is a number that is the same in both Trailer Number In and Trailer Number Out. I need to exclude any records WHERE the value exists in both fields from the query results
and also include Bobtail Out if it is True
Attached Images

ID's for Insert and Modified Fields

$
0
0
Just curious if you all add ID's with your Inserts and Modified (Date) fields. Such as 1 would indicate if the record was inserted manually, whereas 2 might indicate it was update or inserted by a web application.

I've never seen tables carry this architecture but now I am seeing it a lot. Doesn't seem incredibly useful.

Thanks for any follow ups.

Sequences, Locks, and Clusters

$
0
0
Hello.
I am currently working with a system that operates on multiple clusters and when creating new records, it uses Sequences to generate the PKs. These are for generally smaller numbers of records at a time, however I am interested in expanding to handle larger batches of records that in addition to the smaller instances, but I would like to cut down on the number of calls required if possible.
I will say that I am aware that I can just do a batch insert and include the NEXTVAL call for the PK in that statement, however I am caching the PK for the duration of processing for other reasons so this will not suffice.

I currently have two thoughts on how to approach this:
1: Alter the sequence in a transaction, incrementing by the number of new rows, store the CURVAL in a temp variable, commit the transaction, and return the temp variable. I can assume that the range of CURVAL - # -> CURVAL are my reserved PKs. I have no idea how to implement this, but would have to assume a stored procedure would be involved. And that I would have one created per PK/ table. Concern is with how the transaction affects the sequence and how

2: Create a recursive CTE, using 0 as my base step and selecting those below the PKs needed. (Or -1 to prevent more than I need I think). I attempted the below:
Code:

WITH CTE AS (
        SELECT NEXT VALUE FOR SEQ_#TABLE_NAME# AS PK, 0 AS STEP
        UNION
        SELECT NEXT VALUE FOR SEQ_#TABLE_NAME# AS PK, STEP+1 AS STEP
        FROM CTE
        WHERE STEP < #NUM_ROWS#
)
SELECT T.PK FROM CTE AS T

My issue with this is the question of recursive CTE performance vs calling for individual values for the same amount. Not concerned with latency between app and db. At the very least I would not be interfering with other connections.

3: I have my two ideas, but I lack experience here. Are there any other suggestions in addition to critique?

Writing Pass Through Queries in VBA #2

$
0
0
Greetings,

I am working with a function written by moderator Sinndho, and posted in an older thread HERE

The problem I am having is, I am getting an error from the function.
Error 3265 Item not found in collection from this line of code

"If Not IsNull(dbs.QueryDefs(QueryName).Name)"

I am calling this function from the code example on post #7 of the previous thread, entering in the SQL string and connection information pertinent to my situation. The SQL string was tested in the server management studio.

I am not sure how to properly paste code into this message , so I hesitate to post the whole function in plain text.

Anyway, if someone would be kind enough to look at the previous post and help me understand why I am getting this error.

MS Access 2007
MSSQL Server 2005

Thank you

Greg

Visual dBASE 5.5/5.7 Professional - printing Crystal reports.

$
0
0
I need help knowing the capabilities of Visual dBASE 5.5 Professional?

I have a large program I have written in version 5.7(NOT the Professional version) and wish to build the files into an .exe file. But the "Build Executable" function will not allow the compiling and display and printing of the Crystal reports that come with v5.5. I get an error message that the "Report Writer is not installed". Is this a shortcoming of my version? ... and would use of the Professional version enable reports display/printing from the .exe file?

Or, would I need to get a copy of the Visual dBASE 5.5 Compiler?

Thanks,

Brian.

Undefined Function

$
0
0
I have a VBA function defined in Access that I call up in an Access query. The query runs perfectly when run locally on my PC. That said, when I attempt to run that same query on a web page I get an error that the function is undefined. I have used several other similar functions, all of which work fine when launched locally. But when accessed through a web page they too fail for the same reason.

Option Compare Database

Public Function WorkingDays(StartDate As Date, EndDate As Date) As Integer
'Return number of working days between two dates
Dim Count As Integer

StartDate = StartDate + 1 'Don't count the first day!

Count = Int((EndDate - StartDate) / 7) 'number of whole weeks
StartDate = StartDate + (Count * 7)
Count = Count * 5
Do While StartDate <= EndDate
Select Case Weekday(StartDate)
Case 2 To 6 'Mon - Fri
Count = Count + 1
End Select
StartDate = StartDate + 1
Loop
WorkingDays = Count

End Function

QUERY:
SELECT Lead_Source_From_To.Leads_From, Lead_Source_From_To.Leads_To, ([WorkdaysCalc]/5)*30 AS Goal, WorkingDays([Leads_From],[Leads_To]) AS WorkDaysCalc
FROM Lead_Source_From_To, [ACT04-Month-Difference];

Access 2010 form posting to database table

$
0
0
I have a form that uses a list box to find the master item to post to the database table. I need all the related data to post to the database table as well. I do have relationships built and the item selected in the list box does post correctly but none of the related data posts. This should help:

Item in list box: Able Well

Related data : State, ID number, lease number, depth, etc.

Only the list box item posts.

Thanks! :o

Recognize users who log in and update fields accordingly

$
0
0
Hi All,

I'm new to this website, but not that entirely new to Microsoft Access. I've been lurking for the last few months. I've been looking over the web and this forum to solve a problem and I can't seem to figure out a solution.

I currently have a basic login form thanks to http://www.databasedev.co.uk/login.html (if posting outside links is not recommended, I can paste the code. I was given this code from another thread I've seen on here).

I've only slightly modified that code to include a case statement (different users will have access to specific forms).

My problem is this. I want to have a field in each form update whenever that user makes an adjustment to one of the fields.

I'll use 3 fields in this example.

1-"status" field: This field has a basic drop-down list of things a user can select from.
2-"status updated" field: Whenever the status field is changed, this field is =now() in the before update action. This way I know when the status was updated. So far it works just fine for my use.
3-"status updated by" field: here is my problem. I want this field to now update to the user who is logged in from the login form posted above. In this case, I have all userID's as initials, so that is what I want posted when the "status" field is changed.

How do I make it so each form can recognize when someone logs in? Is there a way I can somehow create a global variable and then say something like "if status field changes, set value of status updated by = userid"? I'm not fluent enough in VBA to handle this.

Deleting Relational Records in a Folder

$
0
0
Good Day,

1) I have been working on a project and have hit a road block, Im sure theres a simple solution but its not working the way I thought it should.

I have a folder with a many-many relational field : See attached image .Brilliant q1.jpg

I have a Button scripted to delete a record from the relational field. I am using the Delete Record(s), Relational Field Content, "Folder", "Field", "Selected Records"
You would think that it would "Delete" the selected records, but it always deletes the current record of the folder, not the relational records...

If I select a relational record, and right click and select " Delete Records" it will delete the relational record as it should.
I need to use the Button method, as I need to ask the user if they are sure they want to delete, because of the way it affects other records in the program.

2) How do I select and extract the Field Values out of an individual relational record? I would like to assign these values to variables so I can search other folder contents based on these values.

Any direction would be valuable.. thank you.

D
Attached Images

Run-time error '3134': syntax error into INSERT STATEMENT

$
0
0
Greetings,

So I'm trying a few things with access and right now im getting an error on this code:

Private Sub cmdKijkFilm_Click()
Dim strSQL As String
strSQL = "INSERT INTO dbo_watchhistory (movie_id, customer_mail_adress, watch_date, price, invoiced)" _
& "VALUES (" & Me.txtmovieid & ", " ' & Me.txtMail & '", #" & Me.txtDate & "#, " & Me.txtprice & ", '0');"
DoCmd.RunSQL strSQL
End Sub

I can't really figure out what the problem is. The error im getting is:

Run-time error '3134':
syntax error into INSERT STATEMENT

Any ideas?

3113 error, field not updateable

$
0
0
Got a 3113 error, no clue what that means. Here is my code

Private Sub Command51_Click()
Dim strSQL As String
strSQL = "UPDATE dbo_customer " & _
" SET dbo_customer.invoiced = '1'" & _
" WHERE dbo_customer.[customer_mail_adress] = '" & Me.txtMail & "';"
DoCmd.RunSQL strSQL
End Sub

Error says: "cannot update "invoiced", field not updateable.

Problem with AFTER UPDATE Trigger

$
0
0
I want to log changes in a table and write them into a Log table using AFTER INSERT, BEFORE DELETE and AFTER UPDATE triggers.
The thing is that the AFTER UPDATE trigger works strange here. When I update more than one column in a certain record the trigger writes the old values into the log table but it works fine if I just update one column.
I reduced it to a test scenario with a small table A and a log table A_Log.


Initialization
INSERT INTO A (RecordID, Value_1, Value_2, Value_3) VALUES (0, 1, 1, 1)#

Update 1:

Code:



UPDATE A
SET
        Value_1 = 2#

  RecordID  Modification              TimeOfChange  OrgRecordID      Value_1      Value_2      Value_3
===========  ============  =======================  ===========  ===========  ===========  ===========
          6  U                1/22/2015 2:47:45 PM            2            2            1            1


Great, as expected.


Update 2:

Code:



UPDATE A
SET
        Value_1 = 2
        ,Value_2 = 2#
       
       

  RecordID  Modification              TimeOfChange  OrgRecordID      Value_1      Value_2      Value_3
===========  ============  =======================  ===========  ===========  ===========  ===========
          7  U                1/22/2015 2:49:26 PM            2            2            1            1


Result is not as expected. Value_2 is still 1, whereas it should be 2. It is, of course, in the main table A.

So, where am I wrong? Any help is very much appreciated.



For a closer look, here is the DDL:

Code:



Create Table A (
    RecordID              INTEGER NOT NULL,
    Value_1              INTEGER,
    Value_2              INTEGER,
    Value_3              INTEGER
)#

Create Table A_Log (
    RecordID              INTEGER NOT NULL,
    Modification          CHAR(1), --I U D
    TimeOfChange          TIMESTAMP,
    OrgRecordID          INTEGER,
    Value_1              INTEGER,
    Value_2              INTEGER,
    Value_3              INTEGER
)#

CREATE TRIGGER TRG_A_AI0
AFTER INSERT ON A
FOR EACH ROW
INSERT INTO A_Log(
        RecordID,
        Modification,
        TimeOfChange,
        OrgRecordID,
        Value_1,
        Value_2,
        Value_3
) VALUES (
        0,
        'I',
        CURRENT_TIMESTAMP(),
        Old.RecordID,
        Old.Value_1,
        Old.Value_2,
        Old.Value_3
)#


-- AFTER UPDATE
CREATE TRIGGER TRG_A_AU0
AFTER UPDATE ON A
FOR EACH ROW
INSERT INTO A_Log(
        RecordID,
        Modification,
        TimeOfChange,
        OrgRecordID,
        Value_1,
        Value_2,
        Value_3
) VALUES (
        0,
        'U',
        CURRENT_TIMESTAMP(),
        New.RecordID,
        New.Value_1,
        New.Value_2,
        New.Value_3
)#



-- BEFORE DELETE
CREATE TRIGGER TRG_A_BD0
BEFORE DELETE ON A
FOR EACH ROW
INSERT INTO A_Log(
        RecordID,
        Modification,
        TimeOfChange,
        OrgRecordID,
        Value_1,
        Value_2,
        Value_3
) VALUES (
        0,
        'D',
        CURRENT_TIMESTAMP(),
        New.RecordID,
        New.Value_1,
        New.Value_2,
        New.Value_3
)#

TIA,
Joe

[ANN] QxOrm 1.3.1 & QxEntityEditor 1.1.7 released

$
0
0
Hello,

QxOrm 1.3.1 (C++ Qt Object Relational Mapping library) and QxEntityEditor 1.1.7 (the graphic editor) just released !

Changes in version QxOrm 1.3.1:
* New class qx::QxModelService<T, S> in QxModelView module to connect a Qt model to services to execute client-server requests (can be used with QML and QtWidgets views)
* Add some useful methods to qx::IxModel class and fix several issues with the QxModelView module
* Support last version of MinGW with large precompiled header bug : new compilation option _QX_NO_PRECOMPILED_HEADER (to enable in QxOrm.pri config file)
* Fix issue when loading several shared libraries on Windows with services registered in QxService module
* Fix the qx::QxSqlQuery serialization process used by QxService module to send requests over network
* Fix an issue with qx::QxCollection<Key, Value> class when inserting an item at last position

Changes in version QxEntityEditor 1.1.7:
* New Navigator window (under project treeview) : useful to navigate over large diagram
* New way to draw relationships (orthogonal lines between 2 entities) + display the relationship type on each side (there is an option to use the old drawing style from previous version)
* Possibility to define a background color by namespace : useful to group all entities in the diagram associated to a same namespace
* New feature to customize entities/enumerations/notes colors at several levels
* Define items colors at project level (menu Tools >> Project settings >> Colors tab)
* Define items colors at namespace level (right-click on the diagram >> Define colors by namespace)
* Define colors at item level : right-click on an item (entity, enumeration or comment) >> Define item colors
* New action to organize automatically the diagram layout, useful after an import process for example (menu View >> Organize diagram layout)
* Improve the DDL SQL export plugin : new option to export relationships as foreign keys constraints in database
* Support the new compilation option _QX_NO_PRECOMPILED_HEADER of QxOrm library (workaround for a known bug of recent versions of MinGW on Windows and large precompiled header)
* Import database by ODBC plugin : fix the import from MS SQL Server database when tables are not located in the default schema (dbo)
* QxEntityEditor Mac OS X version : fix an issue to load the QxEEPrinter plugin
* Export plugin to C++ model/view project : new option to generate models based on the new QxOrm library class qx::QxModelService<T, S> (models based on services to execute client-server requests)

qxee_sample_small.png

For more details about QxOrm library and QxEntityEditor application, please go to website : http://www.qxorm.com/
Attached Images

select using arrays

$
0
0
select using an array




I have a Postgres function where one of its' parameters is an array. I want to use the values in the array in a WHERE clause. My codeis below. It is the line: where I'm saying ANY (costfiles) that I'm having trouble with.

CREATE OR REPLACE FUNCTION getmanagersaep(costfiles bigint[], manager bigint, level integer)
RETURNS SETOF managers AS
$BODY$
DECLARE
RECORD_OWN_USER managers;
RECORD_CHILD managers;
WEMUSERS_REC wem_users;
costFiles ALIAS for $1;
level int;
BEGIN
FOR RECORD_OWN_USER in
select distinct m.manager_id id,u.name reporter_name from wem_users m, wem_users u , costs where m.manager_id=u.id
and m.customer_id=(select customer from wem_cost_file where id =costfiles[1] )
and costs.wem_user=u.id
and costs.cost_file in costfiles = ANY (costfiles)
LOOP
RETURN NEXT RECORD_OWN_USER;
END LOOP;

END;
$BODY$
LANGUAGE plpgsql VOLATILE
COST 100
ROWS 1000;
ALTER FUNCTION getmanagersaep(bigint[], bigint, integer)
OWNER TO voxware;

Possible issue

$
0
0
Has anyone had this happen? When returning from editing a form and with a internet page opened, that v10.54 will return you to the open web page instead
of back to the database. You close the web page and the database is up

Upgrade to Windows Server 2012?

$
0
0
Hello everybody. I am a systems administrator for a real-estate and development company in the Buffalo, NY area. Between corporate office and the other 7 off-site locals I manager around 100 internal workstations as well as agent-owned devices (laptops, tablets, mobile devices). We utilize Windows Server 2008 RT to manage our file, print, antivirus, mail and active directory servers. We also utilize a SQL server for our databases using a program by the name of Yardi. Things have been running rather smoothly although I've own been working for the company for 4.5 months. That is my entire career in IT thus far as just becoming a graduate with my Bachelor's Degree. I run the entire IT department myself because the director of IT had unexpectedly resigned.

This question is more of an inquiry for advice down the road. When is it suitable for myself to upgrade our servers to say Windows Server 2012? 2008 is now 7 years ago and although things have been running correct when do I start to make that decision when our servers need an upgrade?

Any advice would be appreciated. Thank you.

paradox or access

$
0
0
I have been a wordperfect user for more than 10 years in my law office and everyone in my office likes the program. I use a series of macros to handle the office work but we are considering a complete office management solution instead. I want to be able to create a user interface that will allow one to be able to view and work with all clients info including, personal info, photos, emails, letters and docs generated in the case, medical records (in pdf format) etc. I want to use a good database program that is not too difficult to figure out and work with. I do not have any formal training in IT. I learn by playing with the programs and some online tutorials. So my question is should I go with Paradox or MS Access? There is a lot more support and online info for Access but Paradox is probably more compatable with Wordperfect. Any suggestions?

Format of db2 license file

$
0
0
I need to update the db2 license.

I got a new license key which looks like this - not the actual key :)
KSU8-II8C-2SSD-D28F-FBBD-I0IS-SKKS-S7FK-0CDC-K9SS-SSBI-7DBB-8D70

I created a new file db2conpe.lic and placed the license key in it as a single line.

I am giving db2licm -a db2conpe.lic but I am getting following error -
[root@rtk-dev01-gr adm]# ./db2licm -a db2conpe.lic
LIC1407N You are trying to register an invalid license certificate file, "/opt/ibm/db2/V10.1/adm/db2conpe.lic".


Is the format of license file correct? Also is that how the license key looks like? Or is there something wrong with license itself. How can I resolve this Issue.

Please do tell me the correct format of license file.

protect table rows against unauthorized changes

$
0
0
hi,
I want to do some changes in mysql db code to protect table rows from unauthorized changes in table rows, so how can do this? where should I start?

Daily Transaction RETREATED

$
0
0
Hello Everybody…. One more concern here… I initially posted a thread on “Daily Transaction”… apparently I had some replies from my bosses here. I couldn’t apply the knowledge I had probably I couldn’t explain myself well. Ive attached a file indicating what I actually want. There are folders which contains student details and each student form has a many-to-many table that takes data on fees payed. Ive created a button that is supposed to print the user’s transaction made for the day after work. Transaction details on print out (name, class, amount paid, payment method, date, time, created user).

attachedFile.zip

Thanks

Regards
Evans
Attached Files
Viewing all 13329 articles
Browse latest View live