If I type in the value, it works properly. If I have the form open with the value already there, the value doesn't get passed.
If I type in the value, it works properly. If I have the form open with the value already there, the value doesn't get passed.
The actual DB file that would be about 10MB of data or just the structure of the DB? One table has 151 fields so I don't feel like writing that out. I'll have to strip table data if you mean uploading the actual DB file.
Well maybe this wil help then....
post #11 has an issue with the strWhere = "[C01] = " & C01
should be
strWhere = "C01 = '" & Me.C01 & "'"
Then post # 14 seems like it is looking for where Criteria. I count only three commas after the name. If you want openargs I believe you need 6 commas after the name of the form you are opening. Check your intelisense as you type.
Here's the code I'm using and what is happening.
1. If I enter data into C01, and it finds the record, it passes the data correctly.
2. If I enter data into C01, it doesn't find the record it says it isn't found.
3. If the field is left blank, it says the C01 field needs to be filled.
4. If I then enter valid data that should find a record after that, it passes nothing.
So having a blank field somehow is tripping up the code.
Code:If Not IsNull(Me.C01) Then ' Dim db As DAO.Database Dim rcdFindMatch As DAO.Recordset Set db = CurrentDb Set rcdFindMatch = db.OpenRecordset("Complaint", dbOpenDynaset) Dim strWhere As String strWhere = "C01 = '" & Me.C01 & "'" rcdFindMatch.FindFirst strWhere If rcdFindMatch.NoMatch Then MsgBox "The grievant number does not exist", vbInformation, "Grievant Numnber Not Found" rcdFindMatch.Close Set rcdFindMatch = Nothing C01.SetFocus Exit Sub Else DoCmd.OpenForm "frmFactSheet", , , "C01 = '" & Me.C01.Value & "'" End If ' Else MsgBox "Please enter grievant number." Me.C01.SetFocus End If
Double post.
You have a line of code that is opening a form with a specific criteria. If the criteria is not met, the form will not open.
DoCmd.OpenForm "frmFactSheet", , , "C01 = '" & Me.C01.Value & "'"
There has to be a value in the current record as well as matching criteria in the recordset of the form you are opening for this to work.
Ok, so let's say I change the Docmd to the six comma version and want to pass the record set recFindMatch as part of the Open Args. Are the recordset fields separated by tabs and how would I represent that separation if I was just passing form fields? Me.C01 & (Tab) & Me.C02? I want to keep my separators consistent so when I use the second form I don't need to be factoring in multiple separators.
I am not sure what you are referring to. Didn't you have a working example of OpenArgs in Post # 7? Maybe you can go back to that and the link Paul provided.
The OpenArgs code in step #7 was in regards to what I was trying to do in step 1 in post #1. The DB related code doesn't need to be there. For what I'm trying to do now is I simply need to pass a recordset to a second forum and receive the recordset there.
The Docmd line is getting me an error.
This is the code I use on the On Load event for the second forum.Code:If Not IsNull(Me.C01) Then ' Dim db As DAO.Database Dim rs As DAO.Recordset Set db = CurrentDb Set rs = db.OpenRecordset("Complaint", dbOpenDynaset) Dim strWhere As String strWhere = "C01 = '" & Me.C01 & "'" rs.FindFirst strWhere If rs.NoMatch Then MsgBox "The grievant number does not exist", vbInformation, "Grievant Numnber Not Found" rs.Close Set rs = Nothing C01.SetFocus Exit Sub Else DoCmd.OpenForm "searchFrmFactSheet", acNormal, , , , , rs End If ' Else MsgBox "Please enter grievant number." Me.C01.SetFocus End If
Code:If Not IsNull(Me.OpenArgs) Then Me.RecordSource = Me.OpenArgs End If
Use "Complaint" for the RecodSource of searchFrmFactSheet and place the following code in your click event in the original form. If this isn't working you can try using the wizard and create a control button. It will ask you if you want to show specific criteria and write similar code.
Dim strWhere As String
strWhere = "C01 = '" & Me.C01 & "'"
DoCmd.OpenForm "searchFrmFactSheet", , ,strWhere
Until I find some other way I'm screwing this up, it does seem to be working now.![]()
The second form wasn't updating the data like it should have so I went and try to fix it, but the passing of data is giving me a blank screen. ere's what I'm trying to do.
Let's say I have 10 fields I fill out in Form A. I then click on a button to pass 5 of those fields to Form B. Forum B has 20 fields total. If I had Form B allow additions, I was getting an error since I was passing the key field to a bound text field. I changed it to be unbound for it and the other passed fields. Since these fields are not enabled, this is OK. I do have the additional fields bound and enabled. Again, when I click on the button in Form A, Form B is simply blank. I tried passing the data via a typical search, but the record wasn't found. I can see an issue with the data being updated but not being tied to a record as well, but I'm not sure. The data seems to be passed correctly but again, the form ends up blank.
OnClick code post validation.
Onload for Form BCode:DoCmd.OpenForm "frmFactSheet", , , , , , Me.C01 & ";" & Me.C02 & ";"..... ' More data DoCmd.Close acForm, "frmComplaint"
Code:Private Sub Form_Load() Dim strOpenArgs() As String If Not IsNull(Me.OpenArgs) Then strOpenArgs = Split(Me.OpenArgs, ";") Me.C01 = strOpenArgs(0) Me.C02 = strOpenArgs(1) Me.C03 = strOpenArgs(2) Me.C04 = strOpenArgs(3) Me.C05 = strOpenArgs(4) End If End Sub
http://allenbrowne.com/casu-20.html
I used the above link to get my form to show. The issue now is that the form doesn't update the record. I used a couple different solutions to solve the blank form issue and yet neither led to a form that updates the record. The form does allow edits. I currently have all of the fields bound and use the before update event. If I use Data Entry No, Allow Additions No, and don't use the Before Update event, it still doesn't update.
Can you post the db here?