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:
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
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?
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
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
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 ?
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.
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).
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