Pass Arguments To Access

Sep 1, 2005

Hello,

I want to be able to pass arguments to an access file on start up. I want to be able to grab this value and then perform an action based on this.

Background:
The program will send an email with details for a change request, the recipient will then need to click on a link to accept or reject this change. So I want them to be able to click the link which will trigger the program to save accept or reject.

Regards,
Todd

View Replies


ADVERTISEMENT

Modules & VBA :: Arguments - How To Pass From Private Sub To Function

Apr 22, 2014

I have a after update event that will match the written record with any exist record in a table in the field "OrgName". If it doesn't find exact match, will call a function with a "soundex" algorithm to see if there is only a misspelling or another name altogether.

In the afterupdate event, I have a string called strOrg (wich is the name I want to compare).

I have the soundex function in a module, so I can use it for several form generally.

What I want is to pass the strOrg to the soundex function, however I don't know how to declare the variables. however I keep having this error:

"compile error: Argument not optional"

and goes to the line tagged as 1 in the private sub afterupdate

The afterupdate sub is the following:

Code:

Private Sub tOrgName_AfterUpdate()
Dim strOrg As String
strOrg = Me.tOrgName.value
If IsNull(DLookup("orgID", "torg", "OrgName = '" & strOrg & "'")) Then
resMsg = MsgBox("This organization name is not in the list. If you want to look for similar names press YES, if you want to register a new organization press NO.", vbYesNoCancel, "Organization not found")

[Code] ....

and the soundex function is declared as

Code:
Public Function Soundex(strOrg As String) As String
Dim Result As String, c As String * 1
Dim Location As Integer

View 3 Replies View Related

Procedure Works Great First Pass, But Not The Second Pass

Jul 15, 2005

Good afternoon, I have a form with a subform and in the first txtbox of the subform in the GotFocus event I have a little procedure which checks the txtboxs on the parent to make sure that there is data in all four of the txtboxes. This works great the first time and it pops up a msgbox and it even setsfocus on the txtbox with no data in it, but if I tab into the subform a second time and there still is no data in one of the txtboxs on the parent form, nothing happens, no message and no setting focus on the txtbox with no data in it. Does anyone know of a way to get this procedure to re-set everytime a user tries to enter the subform? Thank you in advance to anyone offering and ideas and suggestions.

View 8 Replies View Related

Modifying Access Pass Through Query Using Querydefs

Feb 8, 2012

I have a pass through query which I want to add a parameter to the end.

The pass through query is very long and has to crate temporary tables on SQL Server in order to generate the required output.

I do not want to retype or try and paste all of this code into a vba module.

Can I use querydefs or something in the querydefs collection to extract the code into a new query and append my parameter along the way?

A simple way of looking at this could be

querytemplate:-

"set nocount off

Select UWREF
from policy
where UWREF like '"

parameter:- (picked up from a text box on a form)
"ABC123"

additional text to follow:-
"%' set nocount on"

In a nutshell that's all I want to do, but as stated beforehand the real world query has a shed load of other code.

View 1 Replies View Related

Update Access Table From A Pass-through Query?

Jun 28, 2012

I want update a table (in Access 2010) based on the results from a pass-through query that pulls data from an old Fox Pro database.

With the following query I push data into my access table (everything works fine):

Code:

INSERT INTO Bolle ( esercizio, numero_documento, ...)
SELECT Bolle_Arca.[esercizio], Bolle_Arca.[numero_documento], Bolle_Arca.[testata_codice], ...
FROM Bolle_Arca
WHERE
Bolle_Arca.[testata_codice] NOT IN (SELECT Bolle.testata_codice FROM Bolle)

When I try to update the same table using the same pass-through query:

Code:
UPDATE Bolle INNER JOIN Bolle_Arca ON Bolle.riga_codice = Bolle_Arca.riga_codice
SET Bolle.esercizio = Bolle_Arca.esercizio
, Bolle.numero_documento = Bolle_Arca.numero_documento, ...
WHERE Bolle.spedito = False
and Bolle.data_invio_mail_spedito is null
and (Bolle.tracking is null or Bolle.tracking = '')
and Bolle.testata_codice = Bolle_Arca.testata_codice;

I get this error: "Operation must use an updatable query"

View 3 Replies View Related

Using Access Form Fields In Pass-through Queries To MYSQL

May 9, 2005

I don't know if this is thebest place for this, but here goes....

I have an Access FE using MYSQL 4.1 BE. I have several forms and PassThrough queries (using MYSQL syntax not supported or available in Access).

How can I use form field values to use as criteria for these queries?

FOr example, in a pure Access database. I may have a form 'Employees' with a text box 'EmployeeName'. THen have a query....

SELECT * FROM tblEMployees WHERE EmployeeName = [Forms]![Employees]![EmployeeName]

If I were to add this variable to my pass-through queries, it errors. How can I do the same thing, passing my form fileds to an Access Query? I am trying to do this right in the SQL view of the queries, not in VBA or Macros or anything.

Thanks,
Scott

View 2 Replies View Related

I Am Trying To Run A Pass-through Query In Access With A Variable That A User Enters

Nov 29, 2007

I am trying to run a pass-through query in access with a variable that a user enters in a form. I can't seem to get this to work. Can somebody please help? The variable should be where the 121212 is in the code.

Code


1:FROM doc..eco_summary es
2:INNER JOIN
3:((((mart..DM_Map dmm LEFT JOIN mart..DM_PI dpi ON dmm.Acct_ID = dpi.Acct_ID)
4:INNER JOIN mart..DM_Note dmn ON dmm.Acct_ID = dmn.Acct_ID)
5:INNER JOIN mart..DM_ACCT dma ON dmn.Acct_ID = dma.Acct_ID)
6:LEFT JOIN mart..DM_RE dmr ON dmn.Acct_ID = dmr.Acct_ID) ON es.L_loannum = dmm.Acct_ID
7:INNER JOIN weis..eco_loan_origination elo ON es.L_num = elo.num
8:where es.L_num = 121212

View 1 Replies View Related

Open Form Using 2 Arguments.

Aug 1, 2005

Hi.
I'm putting together a database of property clients and i have almost finnished but as always i seem to get so very close to the end of a project and i hit a wall.

background:- I have about 5 different tables which mostly have relationships but there is one main table (clientDetails) which holds the main record this has a very predictable clientID primary Key. the other tables have equally predictable keys for the tables ie: LettingID for a letting client insuranceID for insurance clients etc.. the deal is really that EVERYONE is a client so they get the main details filled out and another record in another table using the primary key of the main table in all other tables. one client can have many other records relating to them useing the primary key.

The Problem:- I have made lots of nice forms that all link up together so you can edit and brose all of the records in the database, and this works very well.. however my problem comes when i want to add a new record in one table that relates to the same record in another using the forms not the table view. eg. on form 1 (clientDetails) i add a new client to the database all fine even using the autonum for the PK. now i bring up the record of that client and i have a button (addProperty) this brings up another form (propertyDetails) using the PK from the previous. this works fine if there is already an entry in the DB but if not then the PK is autonumbered..

What i need:- I need to be able to open up a form using PK then (addProperty) button to the next form which finds that record using the pk (clientID) and FK (propertyID) and if there is no FK relating to the PK then to autonumber and use that... so i basically transfer the PK from form 1 to form 2 regarless of any other data relating to it, and auto numbering to the next number in that table for the FK.

eg.

form1 form 2
------- > ---------
PK=100 PK=100
FK=5

this is probibly really basic.. but i hope someone can help ..

Many thanks.

chiller149@gmail.com = is me..

View 3 Replies View Related

DoCmd.OpenForm Arguments

Jan 24, 2005

Hi,

I have got an unbound access form, and in this form I gather 2 dates (i.e. through txt fields). Once I have these fields, I want to open a form that has one list box on it. This list box should populate based on the dates that I gather on the previous form. How do I specify this through the DoCmd.OpenForm arguments? Currently I have the following code, but it is not working:

Form 1:
Dim whereClause As String
whereClause = "SELECT * FROM qryInvoice WHERE tblInv.InvDate Between #" & txtStartDate & "# And #" & txtEndDate & "#" & ";"
DoCmd.OpenForm "frmInvoiceFax", acNormal, , , , , whereClause

Form 2:
public Sub Form_Load(args As String)
MsgBox args
lstInvoice.Rowsource = whereClause
End Sub

I know I am not doing it the right way (because it is not working), but I can't actually find how to do it. Help!

View 2 Replies View Related

DISTINCT And WHERE Arguments In SQL ASP Query

Jan 20, 2007

I'm going nuts here...can you privide some help.

I'm trying to QUERY an ACCESS database called ARQUIVO and i would like to have from the column EMPRESAS all the DISTINCT records that have the same 'aviacao' in the INDUSTRIA column.

and it goes like this:
Code:<%Set rse = Server.CreateObject("ADODB.Recordset")sSQL = "SELECT DISTINCT empresa FROM arquivo WHERE industria='Aviacao'" rse.open sSQL,con, adOpenStatic, adLockPessimistic, adCmdText%>

But all I get in a 500 error.

The fact is that if I use "*" instead of "empresa" the query runs but i list all the records with 'aviacao' in INDUSTRIA


I have this SQL query made in ACCESS - that does what I want - but it doesn't rune in mine ASP page.

SELECT DISTINCT arquivo.EMPRESA, arquivo.INDUSTRIA
FROM arquivo
WHERE (((arquivo.INDUSTRIA)="Cāmaras Municipais"));

Would anyone help on this?

View 1 Replies View Related

Wrong Number Of Arguments

Jan 8, 2008

Can you help me? I get the error wrong type of arguments in my function as follows
Private Sub Command0_Click()
Call ANewDBWithPass("c:BELest", "secret")
End Sub

Function ANewDBWithPass(ByVal tName As String) '// adds the current date to the name of the database
Dim wsp As Workspace
Dim db2 As Database
Set wsp = DBEngine.Workspaces(0)
If Right(tName, 4) = ".mdb" Then
' Remove .mdb from the name
tName = Left(tName, Len(tName) - 4)
End If
' Add date and extension
tName = tName & Format(Date, "dd-mm-yyyy") & ".mdb"
' Create database
',Set db2 = wsp.CreateDatabase(tName, dbLangGeneral)
Set db2 = wsp.CreateDatabase(tName, dbLangGeneral & ";pwd=" & strPassword)
db2.Close
End Function

View 3 Replies View Related

Modules & VBA :: Run Python Method With Arguments?

Aug 18, 2014

I have a python script "runAll" that takes two arguments: processID (the primary key of one table as a string) and a filename (a full file name path as a string).

Is it possible to run a python method with arguments from inside a VBA script (activated by a button press)?

My python script is called XMLGenerator.py, and the method I want to run is called runAll(processID,filename).

View 4 Replies View Related

General :: Calculate Days Using 2 Arguments

Dec 18, 2012

I have a database to monitor incoming emails from our contractor & my superior wants it to have control like the following situations:

1. If no respond yet, to calculate today's date minus received date
2. If responded, to calculate respond date minus received date

If i use the following expression, it does not relate to if the emails have no respond yet or have been responded.

IIf(IsNull([Reply Date]),DateDiff("d",[Due Date], Now()))

View 4 Replies View Related

VBA Passing Array Arguments To Procedure

May 13, 2015

The procedure call "Call RearrangeCoordinates(RearrangeCoords(), ReturnCoords())" return a message "Type mismatched: Array or user-defined type expected"Are there any views as to why the message is being displayed?

Private Sub CommandButton1_Click()
Dim ReturnCoords As Variant
Dim ...........................................
ArrayLength = UBound(ReturnCoords)

[code]....

View 2 Replies View Related

Command Line Arguments To Open AND Close Db

Jan 24, 2008

Is there a command line argument to open AND close a db? I am running a schedule task to open a db which has an autoexec macro but I don't want the db to stay open after running the macro. Or is there a close db function in a macro? I see close form but not db.

View 2 Replies View Related

Modules & VBA :: Date Expression For DCount And Where Open Arguments

Oct 9, 2014

I am getting something wrong but I don't know what - date related.

Take this code for example:

Code:
Dim varDate
varDate = Date
If DCount("RunningNumber", "AllocatedVehicles", "ServiceDate=" & varDate) > 0 Then
MsgBox "Go Away", vbOKOnly
Else
Go on and do the real work
End If
End Sub

The DCount line is being completely ignored, no error message, it just cracks on as though there were no records found (but they are definitely there!) I have tried:

Code:
Dim varDate
varDate = Date
If DCount("RunningNumber", "AllocatedVehicles", "ServiceDate='" & varDate & "'") > 0 Then
MsgBox "Go Away", vbOKOnly

But that throws up a Type Mismatch (which is what I would expect). Then I tried

Code:
Dim varDate
varDate = Date
If DCount("RunningNumber", "AllocatedVehicles", "ServiceDate=#" & varDate & "#") > 0 Then
MsgBox "Go Away", vbOKOnly

And it gets ignored again.

I am having similar trouble trying to open another form using the same field as the open argument, and getting similar results, so it is clearly me that is wrong.

View 7 Replies View Related

Modules & VBA :: DLookup Error - Wrong Number Of Arguments

Jul 1, 2013

Access 2010

I am trying to check for when a user trys to enter a duplicate number.

The control that I am checking is in a subform on the main form:

Main: frmCandidateInfo
Sub: frmTestInfo

Control on the subform is: RankOrder

I am trying to check the control entry against the table entry:

Table: tblTestEvents
Field: RankOrder

Here is what I have:

Code:
Private Sub RankOrder_BeforeUpdate(Cancel As Integer)
Dim lngRankDup As Long
lngRankDup = Nz(DLookup("[RankOrder]", "tblTestEvents", "[RankOrder]=" & Forms!frmCandidateInfo!sfTestInfo!Form!RankOrder, 0))
If lngRankDup <> 0 Then
MsgBox TestEventID & " already exists in the database"
End If
End Sub

I know that the error is due to the argument not being correct, but I am not sure how to fix it.

I have tried:

Code:
lngRankDup = Nz(DLookup("[RankOrder]", "tblTestEvents", "[RankOrder]=" & Me.RankOrder, 0))

Code:
lngRankDup = Nz(DLookup("[RankOrder]", "tblTestEvents", "[RankOrder]=" & [RankOrder], 0))

Code:
lngRankDup = Nz(DLookup("[RankOrder]", "tblTestEvents", "[RankOrder]=" & Forms!sfTestInfo!Form!RankOrder, 0))

But nothing seems to work.

View 3 Replies View Related

UDFs That Accept Arguments To Process UPDATE/INSERT INTO SQL Stmts?

Mar 17, 2006

Before attempting to create a VBA User Defined Function that will accept arguments for creating UPDATE/INSERT INTO SQL statements, I thought I would check to see if some already exist. It seems like a very tough task to tackle. I'd like it to determine the data type of the the values being placed into the specified fields and subsequently provide the appropriate syntax. (i.e. '" & mString & "', #" & mDate & "#, etc.) Do any exist?

I'm working with MS Access 2003.

Thanks,

Steve G.
:confused:

View 1 Replies View Related

UDFs That Accept Arguments To Process UPDATE/INSERT INTO SQL Stmts?

Mar 17, 2006

Before attempting to create a VBA User Defined Function that will accept arguments for creating UPDATE/INSERT INTO SQL statements, I thought I would check to see if some already exist. It seems like a very tough task to tackle. I'd like it to determine the data type of the the values being placed into the specified fields and subsequently provide the appropriate syntax. (i.e. '" & mString & "', #" & mDate & "#, etc.) Do any exist?

I'm working with MS Access 2003.

Thanks,

Steve G.

View 1 Replies View Related

Converting Access Query To Pass-Through Query

Dec 23, 2005

Can anyone help? I have a query that queries against 11 linked views against an SQL Server backend.

The query is running dog slow, so I want to convert it to a pass-through query so that the processing is done server side rather than Access having to drag thousands of records across the network, but don't know where to start.

The problem is that I need to convert the Access SQL to a version of SQL that SQL Server understands.

Is there a tool I can use that does this automatically (keeping my fingers crossed here)? If not then does anyone know where I can find out how to do this?

View 2 Replies View Related

Pass A Parameter...

Aug 18, 2006

Hi there

When using parameters from one form to the next I normally hide the form and then reference the parameter textboxes in the next form to the hidden form. Is there a better way of doing this as I saw threads here mentioning passing a parameter. How do I do this? Thanks!

Dave

View 3 Replies View Related

Pass Value Between Forms

Oct 24, 2006

Hi,

I want to pass a value between two forms. I created a text field in one of the forms and tried to access it using:

aVariable = frmSearch.txtQryName.Text

It's not working for me. Is this correct?

Thank you,
B

View 5 Replies View Related

Pass-Through Query Help

Jul 13, 2007

I'm trying to create a PTQ and just cant seem to find the source table.

The name of the source table is PRM1_ORG_MTRX3_N

If I write my query like this, I get an error code that states username.PRM1_ORG_MTRX3_N is an undefined name. It adds my userid to the beginning of the table name.

SELECT
T128.AS_OF_DATE,
T128.LEVEL8,
T128.LEVEL8_ORG_NAME,
T128.LEVEL9,
T128.LEVEL9_ORG_NAME

FROM
PRM1_ORG_MTRX3_N as T128

WHERE
T128.AS_OF_DATE like '1/1/2007'

Then I rewrote the query like this, and I got and error code that said PRM1.ORG_MTRX3_N is an undefined name. Does anyone know what else I can try here to get this query going? Thanks


SELECT
T128.AS_OF_DATE,
T128.LEVEL8,
T128.LEVEL8_ORG_NAME,
T128.LEVEL9,
T128.LEVEL9_ORG_NAME

FROM
PRM1.ORG_MTRX3_N as T128

WHERE
T128.AS_OF_DATE like '1/1/2007'

View 2 Replies View Related

How To Pass Value Between Two Forms?

Feb 11, 2005

Hello!!!
I have a big problem. I have form A which display list of user errors. I need to pass selected error from that form A to another form B which contain user data in main form and error data in subform (this is error which I want to pass from A).
Form B tells me which error was reported from particular user. Errors are predefined in separet Form (A).

I hope you will understand me. I need help, because I am losing my maind with this one.....

View 3 Replies View Related

Pass The Value To DataSheetView

May 25, 2005

How to pass the values from the first page to the second page? The first page contains the lists of Area_Code. After selecting the area_code and the button being clicked the second page automatically call the Query1 (where the area_code's Criteria is Forms!MainForm!SubForm!txtAreaCode) and get the data back on the DataSheetView on the second page.

I found many people use the comboBox and AfterUpdate() to requery the data. But my case is different. Because on the first page, I have a list of area code which has the button to check the authorisation before continuing to the second page.

Thank you very much!

View 3 Replies View Related

Pass Parameters

Aug 30, 2005

I need some help please on passing parameters such
as a recordsource to a report but not using OpenArgs
I heard that this can be done using a hidden form.

I have a calling form (form1) which opens a preview snapshot
form (form2) which in turn brings up a rptCurrentRecord (form3)
I can't get the openargs RecordSource SQL from form1 to form3

For arguments sake, Form3 in this case is really the report itself.

Hope this is not too confusing.

Thanks for any help

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved