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 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

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

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

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 7 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

Refreshing From Pop Up

Jun 17, 2005

Hello all I hope that you can help

I got a database that has lots of subform which are all locked, I got a button that open the same subform in a pop up form with a macro that insert a new record. But when I close the subform after puting the information in the new record does not update on the main form untill you go away from the current record and come back again

Any Ideas

Postieman

View 1 Replies View Related

Refreshing Subforms

Nov 22, 2005

Hi there.
I have a form with two sub forms on it. The form loads with a reference number that I pass to a function that in turn requeries the first sub form. The function call is in the on load event of the main form.
This part works fine.
The second sub form uses a similar requery function to the first one. The only difference is that the query for the second sub form is based on a reference number from the selected record in the first sub form.
If I put the function call for the second sub form in the on click of the first one all is well and the second sub form displays all records with a matching reference number.

The problem is that when the main form loads the first sub form will display the correct data but the second remains blank or displays the wrong data.
I know this is happening because the first sub form has not loaded fully and so the second sub form cannot get the reference number. I just can’t find a way to make the second sub form display the correct data when the main form loads.

I have tried calling the requery function for the second sub form from most of the events on the main form and many of the events on the first sub form but to no avail.
I also tried putting a meaningless sub form at the bottom of the main form and putting the requery function for the second sub form in the on load event but that was no good either. This surprised me as until that point I was assuming that access was loading the sub forms sequentially from top to bottom.

Can anyone tell me how I might determine the point at which the first sub form has been loaded so that I can get access to the reference numbers needed for the second sub form query. I would prefer not to use a timer for this as there is no way to determine the maximum time it will take access to load the rest of the data but at present it looks like the only option left.

Any comments would be much appreciated and sorry for the lengthy explanation.

View 6 Replies View Related

Refreshing ActiveX

Nov 24, 2005

I just added a ActiveX control to my program and I have a scroll mouse, and there when the user used the mouse to scroll through the records, the record changes but the ActiveX Control doesn't. My activeX Control is used for a digital signature. Anyone Have any ideas?

View 2 Replies View Related

Refreshing A Database

Jul 27, 2006

This is a lot more complicated than the title suggests. I was asked to reset the work order numbers used by the maintenance department. When they reach work order #9999 they want to start over. My best bet is to make a backup of the tables and create new ones that include the last 2-3 weeks of activity. If I do that I'll have two potential problems:

The next autonumber needs to be lower than the pre-existing records but not start at 1
Recombining data from the old table (for whatever reason) will create false relations

Does anyone know a possible solution to these problems or is there a better method to refresh the database?

View 8 Replies View Related

Self Refreshing Query

Apr 1, 2007

I have a 'Snapshot' report, which gives up-to-the-minute data on a business - sales year-to-date, month-todate, week-to-date and today. They run this many times a day, but ideally, they would like to have the information display on a monitor, and be updated automatically every few minutes.
Is there any way that a query can run by itself every few minutes, and gather the current information?

Robert

View 4 Replies View Related

Refreshing ODBC

Jul 4, 2007

Hi Guys

Quick question, in Access 2007, i created a table that pulls data out of our system via ODBC. No if the system gets updated, how do i refresh data in access? Please advise. Thanks in advance.

View 1 Replies View Related

Refreshing A Form

Feb 24, 2005

I have an orders form which contains an items subform.

To populate the items subform I have a button which opens a separate pop-up form.

Is there a piece of code which would allow me to click a button on that pop-up form which actually refreshes the other opened form (orders form)???

Anyone know if this is possible?

Thanks,

Paul.

View 2 Replies View Related

Refreshing Fields

May 26, 2005

Hey All,

I have a field "NameView", irrelevant but it grabs a name from a seperate form from an ODBC connection.
The purpose for the field is simply to grab the data from another form.

On the same form As NameView theres another field "Name"
This Grabs the data from NameView and writes to the main table.

Everything works fine but "Name" will only update from "NameView" on a new record only and not on the current one.
I have a VBA Statement on an afterupdate which Me.Name = Me.Nameview

I've tried Me.Refresh and Me.Requery but no help.

Any thoughts?
Much appreciated
Thanks

View 4 Replies View Related

Refreshing Issue

Jul 15, 2005

Hi,

I know this is probably something really simple - but I'm relatively new to VBA.

I'm trying to run an update query from a form, then refresh the form having all the input boxes and checkboxes etc set back to normal.

The problem being that I have a list box to select a record to update from.

Now, if I just refresh the form this list box updates properly - but none of the other controls (text boxes and check boxes) reset to their defaults.

If I try to reset them manually in the code then a) they don't reset and b) the list box no longer updates (depending on the location of the reset code).

Though the code I'm using to reset things works when the query is not executed.

The code I'm using is currently:

Private Sub Save_Record_Click()
On Error GoTo Err_Save_Record_Click

Dim stDocName As String
DoCmd.RunCommand acCmdSaveRecord
stDocName = "Return to training"
'DoCmd.OpenQuery stDocName, acNormal, acEdit
Me.Refresh
Current.Value = False
Exit_Save_Record_Click:
Exit Sub

Err_Save_Record_Click:
MsgBox Err.Description
Resume Exit_Save_Record_Click

End Sub

I should add that in the above version of the code the list box does update but the check box still does not.

I'd really appreciate any help you can give me.

Thanks!

View 2 Replies View Related

Refreshing Form - Please Help

Dec 8, 2005

Hi

I double click a combo box which takes me to a new form. e.g. a purchase order form does not have an employee so they need to be added. When the employee form is closed i would like to refresh to combo box so the new employee appears in the combo box.

Please help

Thank you

View 3 Replies View Related

Subform Not Refreshing

Jan 27, 2006

I have no VB skills at all have to do everything with macros etc. So please keep any replies simple. I have a database for students, courses and tutors - all worked fine until the customer wanted each student to do 2 courses at a time. The whole database is designed for statistical returns ie females with child care responsibilities living in a rural area etc., and the Course Id has to be the same on each course table. I split the course table into 2 tables with the same data, made a course entry form which appends new courses to both tables. My problem is that when I select a course ie no 234 for course 1 and 345 for course 2 I cannot get the subform to show the data unless I go to the next/previous record and back again; when I do this the main form opens at record 1. Is there a macro or piece of code I can use to automatically refresh OR a macro that will go to next record and then reopen the mainform at the place where I started?

View 1 Replies View Related

Continous Refreshing

Feb 26, 2006

Hi!

I'd like to ask for your help in the following issue:

I wanted to refresh the filtering of my combo-list on a subform according to the change of a field on the main form.

With this

Private Sub supplierID_AfterUpdate()
Forms![invoices]![details1 Segédűrlap]![KombináltLista4].Requery
End Sub

it succeeded. But when I turn a page on the main form (to see records registrated in the past), the combo-list on the subform doesn't change (because Access doesn't get any after-update info - I guess).

But I'd like to use a solution that always watches the actual value of the main form displayed on the screen and so it changes the filtered list of the sub-form - combo-list according to it.

Please help if you have a good idea/solution to it.
(take care I'm beginner at Visual Basic)

Thanks

xxyyy

View 1 Replies View Related

Refreshing Pictures

Mar 24, 2006

Hello all,

I have search the forum for two days and can not find anything about this promble so any help would be good.

I am using a linked picture i have then browser setup and works ok but my issue is that i can not get the picture to refresh its self, with out going into design view and then back to my form, i would hope that there is a solution to this.

Any links would be good or general help would be great as i am starting to loss sleep over this now.

Thanks in advance

Alastair

View 1 Replies View Related







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