OpenArgs And Find Record Combination

Dec 9, 2014

The access website says there is a way to use the open arg in combination with the FindRecord method to open a form up to a specified client name. I'm trying to have a macro that asks the user what student they are looking for and then takes them to the form with that name. The reason I can't use a query or something else is because I have macros on the form page that I want them to have access to.

So my question is this.

What's the best way to make a macro that will
1) ask the user for a name input
2) open an already made form
3) take them to a specific record based on the input name

I tried to use something with InputBox and DoCMD.OpenForm but I'm running face first into a wall any time I tried to combine the two.

View Replies


ADVERTISEMENT

OpenArgs?

Feb 21, 2005

I've read about 50 posts regarding passing a value from one form to another, and I Just don't get it!

I have a table of zipcodes which I use to autofill city and state fields. The Zipcode is entered into txtCoZip. If the zipcode is in the table it autofills, but if the zipcode is not in the table, a form opens to add it to the table. OpenArgs seems to be the answer to this, but I can't quite follow it all the way through. This is the code I'm using to open the form:

DoCmd.OpenForm "frmAddZipcode", OpenArgs:=Me.txtCoZip

This is the code I'm using on the onOpen event of frmAddZipcode:


If Not IsNull(Me.OpenArgs) Then
Me.ZipCode = Me.OpenArgs
End If

I'm getting an error "you cannot assign a value to this object'.
What am I doing wrong?

Thanks,
Sup

View 3 Replies View Related

General :: Find Record From Field In Subform And Then Return Its Parent Record

Feb 6, 2014

I have a database which has a main form and subform built in linked by parent/child customerid, what i would like to do is search all the subform records from the whole DB and return its parent record on the main form?

Can this be done? because if i use find it will only search the filtered form i have onload of the form?

My onload event is based on fosusername()

View 3 Replies View Related

OpenArgs Always Null Value

Nov 6, 2007

Hi Guys,

I have 2 form (Form1) is a log-in form, (Form2) is the Data Entry. After Authenticating the user on Form1 I used DoCmd.OpenForm "MyFormName", , , , , , varUserName, then open Form2 with following code on OnOpen event:

If Not IsNull(Me.OpenArgs) Then
Me.txtUser.Value = Me.OpenArgs
Me.Requery
Else
MsgBox ("Null")
End If

but it always shows the msgBox "Null"

What seems to be the problem with this?

Thanks in advance.

Jeff

View 3 Replies View Related

Refreshing OpenArgs?

May 16, 2005

Hi all,
I have a form (sub_Main) that opens and has an openargs value (Department) from my main form when user clicks on a cmd button. However, if I were to go back to my main form and click on another department the openargs value is not passed along. I have tried using Me.Refresh under LostFocus but it doesnt seem to work.

What is causing the openargs value from updating? Any help?

Thanks!

View 5 Replies View Related

Openargs Problem

Jun 22, 2005

Why do I get and error with this code? It says the openargs is null when I run it

Private Sub TXT_SALESMAN_NUMBER_DblClick(Cancel As Integer)
Dim StCustNumber As String

StCustNumber = Me.TXT_SALESMAN_NUMBER.Text
DoCmd.OpenForm "Frm_Slm_Name", acNormal, , , , , StCustNumber
End Sub


Private Sub Form_Open(Cancel As Integer)
Dim StCustNumberSub As String


StCustNumberSub = Forms![frm_slm_name].OpenArgs
DoCmd.GoToControl "Salesnumber"
DoCmd.FindRecord StCustNumberSub, , True, , True, , True

End Sub



Thanks
Andy

View 4 Replies View Related

OpenArgs Problem

Aug 27, 2005

I have a calling form with the following code

Dim strTbl As String
Dim strTitle As String
Dim strSQL As String

strTbl = Me.cboRep.Column(0)
strTitle = Me.cboRep.Column(1)
strSQL = "SELECT tblSupp.SuppName, tblCurr.CurrName, * " _
& "FROM tblCurr INNER JOIN (" & strTbl & " INNER JOIN tblSupp " _
& "ON " & strTbl & ".SuppID = tblSupp.SuppID) " _
& "ON tblCurr.CurrID = " & strTbl & ".CurrID;"

DoCmd.OpenReport "rptList", acViewPreview, , , , strSQL & "," & strTitle

On the Report's OnOpen Event I have

Dim strStr1 As String
strStr1 = Left(Me.OpenArgs, InStr(Me.OpenArgs, ",") - 1)
Me.RecordSource = strStr1

And on the Report's On Activate Event I have

Dim strStr2 As String
strStr2 = Mid(Me.OpenArgs, InStr(Me.OpenArgs, ",") + 1)
Me.txtTitle = strStr2

This should work but it doesn't. The error states that the SQL statement
was not found. Of course, without the second concatenated argument
and Me.RecordSouce = Me.openArgs everything works fine.
Can anybody see where I have gone wrong

Thanks

View 5 Replies View Related

OpenArgs, Two Parameters

Oct 30, 2006

I have used the OpenArgs method to pass a parameter to another form, but I now need to psss two parameters, and I am not sure how to do this.

On Error GoTo Err_CmdOpenForm_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmName"
DoCmd.OpenForm stDocName, , , , , , Me.Text0 'need to pass another
'Parameter Me.Text1
Exit_CmdOpenForm_Click:
Exit Sub

Err_CmdOpenForm_Click:
MsgBox Err.Description
Resume Exit_CmdOpenForm_Click

And on the Load event of frmName, Me.Text1 = Me.OpenArgs 'and Me.Text2

View 5 Replies View Related

OpenArgs Problem

Sep 9, 2004

I'm making a DB for invoices.

I'm trying to make it so that an item can be returned by clicking a command button (cmdReturn) and a form (Returns) will be brought up with the ItemID field already filled in. I'm trying to use OpenArgs but am having problems. At the moment i've got

In the command button:

Private Sub cmdReturn_Click()
Dim varItemID As Integer
Me.Refresh
varItemID = Me.txtItemID
If Not IsNull(varItemID) Then
DoCmd.OpenForm "Returns", , , , , , varItemID
Else
MsgBox "No valid item to return", , "Error"
End If
End Sub

And in the Open Event of the Returns form:

Private Sub Form_Open(Cancel As Integer)
Dim varDCount As Integer, varOpenArgs As Integer
varOpenArgs = Me.OpenArgs
varDCount = DCount("ItemID", "Returns", "[ItemID]= 'varOpenArgs'")
If varDCount = 1 Then
DoCmd.GoToControl (Me.txtItemID)
DoCmd.FindRecord varOpenArgs, , , , , acCurrent
Else
DoCmd.GoToRecord , , acNewRec
ItemID = varOpenArgs
End If
End Sub

I'm getting this error message:
"Run-time error '94':
Invalid use of Null"

And the line in bold above is highlighted with the mouse over message saying "Me.OpenArgs=Null"

If an item already has a Return entry, I want it to go to that entry instead of making a new one. ItemID is the primary key in both tables, linked in a ONE TO ONE relationship.

Any help is appreciated, please ask questions if something's not clear.
Joe

View 3 Replies View Related

Same Subform On Different Tabs - Openargs Help

Aug 31, 2006

Hi
I have a form with some tabs. Each tab has 2 subforms, of which the 2nd subform is always the same (call it SubformB).

I had it set up before so that the SQL query to run is passed in the openargs property to that that form and this works well.

However, on a tabbed form, each tab opens up Subform B as soon as the page is loaded. Is there a way to pass openargs to SubForm B on each of the tabs so that they all run different SQL queries even though they are essentially the same form ?

View 1 Replies View Related

Modules & VBA :: Send OpenArgs As Array?

Apr 28, 2015

Is it possible to send several form's OpnArg as Array ? Now I'm using a long text string including || as divider so I can split them later into Array.

View 8 Replies View Related

Public Variables, OpenArgs And Compatability Issues

Aug 10, 2005

Hi all,
I seem to have encountered a strange problem at work.

I declared a public variable for user department. The user selects his department from a Log On form and if the password is correct, he opens another form with the department variable passed on in openargs.

All of this works fine in access2k but upon testing with 2003, the openargs somehow do not seem to be being passed on. Maybe I am being dense somewhere but it is kinda puzzling for me.

I am not using access's security for users and groups because I am trying to reduce the complexity of the whole project (I wont be around to maintain it next time).

Any help rendered is greatly appreciated!

View 2 Replies View Related

Error 2001 Problem With OpenArgs And Filter

Jan 12, 2006

Ok heres the situation, Ive had to edit a piece of code that worked fine filtering but wouldnt allow me to refresh a subform on the main search form. Now im using OpenArgs to pass the Selected bike ID to a popup form. This bike ID should then be used to filter the pop up form. But i get error 2001 (You cancelled the previous operation) when the code is run.
The Code follows:

Private Sub cmdSell_Click()

Dim stDocName As String
Dim stLinkCriteria As String


stDocName = "frmSubSell"


DoCmd.OpenForm stDocName, , , stLinkCriteria, , acDialog, Me.frmSubBikes!BikeID

Me!frmSubBikes.Form.Requery




Private Sub Form_Open(Cancel As Integer)
Dim SearchStr2 As String
SearchStr2 = "[BikeID]= " & Chr$(34) & Me.OpenArgs & Chr$(34)
Me.Filter = SearchStr2
Me.FilterOn = True

End Sub



Thanks, Sci

View 5 Replies View Related

Forms :: Populate Form Control With OpenArgs

Sep 19, 2014

I have this code in a button on my Patient Form:

Code:
DoCmd.OpenForm "frm_Admissions", acNormal, , , acFormAdd, , "NHS Number|" & Me.[NHS Number]

And this in my Admissions form LoadEvent:

Code:
Private Sub Form_Load()
'Use this version if the ID is a number
Dim x As Variant

[Code]....

The expression you entered refers to an object that is closed or doesn't exist

Borrowed code from: [URL]

View 5 Replies View Related

Combination Set

May 13, 2005

Hi,

I am designing a database that can sell items 'individually' and by the 'case' e.g 12 items that are sold at a discount price.

For example, a 'case' or 'combination-set' may either have 4 x 3 items, 3 x 4 items or 2 x 6 items etc. Each case would have a 'case-code' and 'case-price'.

So far I have an 'OrderID', and a 'ProductID' table that are linked into a one-to-many relationship to a 'OrderDetailID' table. This part works fine when selling individually items...

How do I link in the items together to sell by the 'case' (12 items) that is a 'combination set' as I listed above.

What extra table(s) do I need?

Thanks in advance for any help.
miranda65.

View 3 Replies View Related

Unique Combination

Jul 31, 2007

I have thought about this for days now (and nights) and I have simplified my problem below. (I even bought a book)
I have three tables: 1, 2 and 3.
Table 1 = a, b and c
Table 2 = x, y and z
Table 3 combines table 1 and table 2; ax, ay, az, bx, by, bz, etc.
Table 1 and Table 2 are both One to Many with Table 3.
The Table 1 field and Table 2 field are a ‘unique’ index combination.
My Problem:
It would be very handy to produce a list of the ‘unique’ index combinations that are not in Table 3. That is, the ‘unique’ index combinations that aren’t used yet.
You could do this by trial and error, but is there a Query you can run that will give you a result that you could then Append?
An Unmatched Query on the Table 3 / Table 1 contents will point out a complete lack of either a, b or c as will the same Query on Table 2 for missing x, y or z.
A query with the two non-linked tables will give every combination, but is this the best way to do it? It works by default when you use it to append table 3, but is it the best way to do it?

View 14 Replies View Related

How To Use Key Find A Record ?

Aug 17, 2005

Hello to all,
Little new in Access i would like to know how to use the key to find directly to a record in a table.
ie : i have a table where the primary key (unique) is a date, using VBA i would like to know the instruction to find directly the record 01/06/2004 for exemple.
Thanks in advance.
VINCENT

View 2 Replies View Related

Find Record

Jun 14, 2005

I forgot to mention that my form is based upon a table, i have created other tables and forms based on this one therefore I don't want to change a lot of stuff. I tried the forum but nothing helped.



I have a form with about 10 fields, i added a find button to search for a record, using three fields, when this button is click i want it to display all the info pertaining to the search criteria, (this will be displayed on the same form populating in the form which contains other feilds) or a error saying record not found.

Thank You

View 2 Replies View Related

Find Record

Mar 30, 2006

Hi, i am a beginner to access and need some help if someone would be kind enough...
i have a table (tblCustomer) which has all the standard customer details such as name, address, phone etc. The primary key of the table is a autonumber field (Customer ID). i have autoformed it so all the fields are now on a blank form. I want to add a text box to the form so that i can find a record by typing the customer's surname. Once this has been searched, i would like the records to be listed in a table in a subform further down the original form. I would then like the user to select the correct record they are looking for from the sub form, and the details to come up in the main form so they can be edited. The reason for the whole sub form part is because there may be more than one customer with the same surname.
please could someone suggest how to achieve this.

thanks

View 3 Replies View Related

Find Record

Mar 30, 2006

Hi, i am a beginner to access and need some help if someone would be kind enough...
i have a table (tblCustomer) which has all the standard customer details such as name, address, phone etc. The primary key of the table is a autonumber field (Customer ID). i have autoformed it so all the fields are now on a blank form. I want to add a text box to the form so that i can find a record by typing the customer's surname. Once this has been searched, i would like the records to be listed in a table in a subform further down the original form. I would then like the user to select the correct record they are looking for from the sub form, and the details to come up in the main form so they can be edited. The reason for the whole sub form part is because there may be more than one customer with the same surname.
please could someone suggest how to achieve this.

thanks

View 7 Replies View Related

Find Record

Sep 26, 2006

I have navigation between forms and when a user navigations from the main form(candidate) to another form(1) and then back there is only 1 record displayed on the candidate form as it is only bringing back the record tied in by the application number.
So if you then want to search for another candidate it doesn't work because the candidate form is filtered.

I've tried using this in my find function but it doesn't work: DoCmd.GoToRecord , , acFirst

Can anyone help?
Thanks,
Dan

View 2 Replies View Related

Combination Of Data From Two Field

Nov 22, 2006

Hi all
I have a table with data like
Field 1 = Ref_No (IM1006/0548)
Field 2 = Loc (CBUS)

I want to combine these two fields in a separate field

Must look like this
Field LocNo = CBUS0548

View 2 Replies View Related

Query Returns Every Possible Combination

Mar 5, 2008

Hi, i'm hoping someone here might be able to help me. I have come to a bit of a dead end with a database application i am working on.

The database is a delivery newspaper management system for a newsagents. Basically i need it to link customers to the paper they wish to receive, organise them into delivery rounds, and produce a bill for each customer based on the newspaper they get delivered.

The problem I am currently having is when it comes to the billing.
I have:
a table that stores customer details
a table that stores newspaper details (inc. price)
a table that stores the customerID and then the NewspaperID for each day of the week. (since not all customers get a paper everyday of the week)

If a customer gets two papers then two entries are made in the requirements table under there CustomerID)

Now to fetch the price of the newspaper the customer is down to receive each day and then add these all together is where i have been having trouble.

After many different attempts the solution i am currently using is this. I have a query for each day of the week. Each query take the customerID from the requirements table, then the newspaper price from the table storing newspaper details.
The problem here is that the query returns the CustomerID next to every newspaper in the database. I found the solution was this. I added the newspaperId from the newspaper details table and in the criteria stated "[tableRequirements].[NewspaperID]" And this worked perfectly.
Untill i added a customer who gets two papers. As far as i can tell the query is returning all the possible combinations of which newspaper the customer should get.

Any help with this would be greatly appreciated - thanks in advance.

View 1 Replies View Related

Modules & VBA :: Combination Of Two Queries

Jun 11, 2015

Is it possible to do combination of these two queries?

SELECT * FROM tblGoraZleceniaNowaWyceny WHERE [id_wycena_pre] = Forms!frmWycenyObszarroboczy!ID_wycena_pre[/CODE]

and

Code:
SELECT [Query1].[NumerArkusza], [Query1].[nazwa], [Query1].[id_wycena_pre]
FROM Query1
WHERE ((([Query1].[numerarkusza]) In (SELECT [numerarkusza] FROM [Query1] As Tmp
GROUP BY [numerarkusza]
HAVING Count(*)>1 )));

I need to do this to work with Recordset.

View 11 Replies View Related

Using Query To Find A Record

Jun 29, 2005

The strSql string should find the record that I have already saved in my admin table and then compare it with combusername, where is my mistake.


Private Sub Command7_Click()


'Dim db As Database
Dim strSql As String
'Set db = CurrentDb()


strSql = "Select adminpass From admin"


If ((Nz(txtpassword, "") = "") Or (Nz(combusername, "") = "")) Then

MsgBox "Please Enter A Valid Access", vbOKOnly, "Error"

ElseIf (txtpassword = "admin" And combusername = strSql) Then

DoCmd.Close acForm, "Secure"
DoCmd.OpenForm "Home"


ElseIf (txtpassword = "user" And combusername = "user") Then

DoCmd.Close acForm, "Secure"
DoCmd.OpenForm "Home"

Else

MsgBox "Wrong Password, Please Try Again", vbOKOnly, "Error"
combusername = ""
txtpassword = ""
combusername.SetFocus


End If

End Sub

View 3 Replies View Related

Find First Record In A Set Of Fields

Nov 8, 2005

I have 12 fields, each containing a number. I want to display the last non zero value in a query. I've looked at "last" but this returns the items in chronological order, which is not neccessarily the order my data is entered in.

eg.
fields: 1 2 3 4 5 6 7 8 9 10
data: 0 7 3 0 0 5 4 0 0 0

I would want the query to return 4, even if the last value entered was the 7.

To make it more complicated, I have many rows of data for each set I am using, and have to aggregate these based on a key column

eg.

Fields: key 1 2 3 4 5 6
Data: 1 0 0 0 2 0 1
1 0 0 0 3 0 3
1 6 5 4 3 2 1
2 1 2 3 4 5 6
2 0 0 0 0 0 0

Any tips?

Cheers
Kev

View 4 Replies View Related







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