Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using textboxes

Status
Not open for further replies.

jonu61

Technical User
Sep 16, 2003
16
US
Hi,

I am creating a database that will be used to keep an inventory of documents. I have a combo box which is used to lookup documents such as floppy disks, etc. Once they have set the combo box to which option they would like I have a retrieve records button. Which when they click on this it opens up all of the information in a report. I want to add a text box so that if the user knows the document ID number they can look up this document and not have to look through all to the documents to find it. I want it set up so that whenever the document ID number is put in and the user clicks retrieve records that one document and it's information will appear in a report. What is the best way of going about doing this?

Thanks,
Jon
 
Hi

Best depends on what you want, but if you want to make use of your retrieve records button to achieve the result then something like (in the onclick event of the button)

If Len(Trim(nz(txtBox,"")&""))> 0 Then
' do the look up via the text box value
Else
' do whatver you do now via the combo box
End if

seems Ok to me

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
I tried this whenever I would click the retrieve data button nothing would happen. I place txtbox with Text30. Should I have included anything else in here. Thanks
Jon
 
Hi

well I assume you included code to replace my comments?, at the very least the original look up should have worked if it was working previously

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Hi Jon, I'll try to be as coherent as possible, assuming I've understood your question.
Your combo box, when dropped, should include the document ID.
Here's my code;
Private Sub NameOfYourCombobox_AfterUpdate()
On Error GoTo NameOfYourCombobox_Err
DoCmd.OpenForm "NameOfYourDocumentForms", acNormal, "", "[YourDocumentID]=[Forms]![NameOfCurrentForm]![NameOfYourCombobox]", acEdit, acNormal

NameOfYourCombobox_Exit:
Exit Sub
NameOfYourCombobox_Err:
MsgBox Error$
Resume NameOfYourCombobox_Exit
End Sub

Once you highlight the drop down box, it will automatically go to the right form record, because the event is "AfterUpdate"
Good Luck!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top