Form not loading after search

Mr. Hero

Registered User.
Local time
Today, 15:01
Joined
Mar 16, 2010
Messages
84
My form finds the record, but when I click the button to load the information into another form, the info does not transfer from the search.

Can any help?

Here is my code:


Private Sub Command8_Click()
On Error GoTo handler
Dim strID As String
strID = InputBox("Enter ID Number", "Search Box")
If [ID].Value = strID Then
Me.RecordsetClone.FindFirst "[ID] like '" & strID & "'"
Me.Bookmark = Me.RecordsetClone.Bookmark
Else
Me.RecordsetClone.FindFirst "[ID] like '" & strID & "'"
If Me.RecordsetClone.NoMatch Then
MsgBox "no record found"
Else
Me.Bookmark = Me.RecordsetClone.Bookmark
End If
End Sub
 
This is the code to "find" the record, not to load it into another form.
 
I agree, I use also this
If formID = "BCK" Then
DoCmd.OpenForm "AAA"
End If
to match the id to the right form.

But I am not sure how to bring over the correct information.
 
I was under the impression the Me.bookmark would retrain the information from the search and when the form opens, the infor would load.
 
Nope! Access does not work that way. As I said, how much information needs to be transferred to the next form? If it is more than an ID number then you may have an issue with the structure of your tables.
 
Okay, there is more then one field. But not even the ID field opens on the form. Basicly, I am attempting with the first form to find the record, then take the found record over and opening all the fields in that record in the form. Any suggestions??
 
Well, I am using More then one form. All the input forms stored the data in one table. I have 3 forms for input, one table. and 3 reports. There is about 12 fields total.
 
Well to further answer your question. I am trying to create a type of functionality. I would like one form to be the search form. and when you type your value in the inputbox, the code then opens the correct form and fills the fields with the data from table. It is worth noting that record stored in the table needs have all the fields fill the form that initially input it. But I need the search form to call the correct form and record.
 
Just for grins, put all of the code you have under Command8 button in the OnLoad event of the next form and see what happens.
 
It worked. Thanks. But, I by passed the search form. Which isn't really what I wanted it to do. I was hoping that the search form would produce what the onLoad did. When I use the record navigation, other records show that should only show in other forms show in this form. Is there a way to lock down the other records, so that the one you search stays and you can't rotate to another record?
 
I was able make it work. One change that I was hoping to avoid. though; I need to have the record open on a newRecord. I tried using docmd.openform , , acNewrec on the Activate event. When I do this the code doesn't produce the search results. Is there a work around either with code or a property?
 
You need to go ahead and use the AddMode and set your field in the OnLoad event by passing the value in the OpenArgs argument.
 
I tried, but I seem to have made it worse... Do you have an example in how I could utilize this?
 
Do *exactly* what you did for my suggestion in post #10. You will see that with some minor modification, this is the right approach.
 
RG, thanks a bunch. I was able to get everything working smoothly. The only thing I don't understand is when I turn the navigation buttons off in the property menu, I am able to use the scroll on the mouse to move between records... Do you have any ideas in how to disable this?
 
Look on the Other tab of the Form's property sheet. Change the Cycle property to "Current Record".
 
I tried using your suggestion. But, I can still scroll through records using the mouse wheel......
 

Users who are viewing this thread

Back
Top Bottom