Urgent Help Needed !!(Searching)

Juggy

New member
Local time
Today, 17:12
Joined
Oct 2, 2003
Messages
7
Howdy Guys,
I have a big problem.

Basically I have a form with 2 text boxes (textboxA and textboxB) and a command button and a table called Table1 with 2 fields, Field1 (which stores the code number) and field 2 (which stores the item description). What I want is to be able to enter a code number into textboxA, click on the search button and then bring up the coresponding item descripton to that code number in textbox2 otherwise an error message should occur that the code number does not exist.

I am having great difficulty doing this as I am shit at VBA and access but wish to improve and this has been bugging me for the last two weeks.

Can anyone provide me with some coding of what should go behind the save button, or put me in the right direction,
PLEASE!, Pretty PLEASE

Kind Regards

Juggy:(
 
Basically I have a form with 2 text boxes (textboxA and textboxB) and a command button and a table called Table1 with 2 fields, Field1 (which stores the code number) and field 2 (which stores the item description). What I want is to be able to enter a code number into textboxA, click on the search button and then bring up the coresponding item descripton to that code number in textbox2 otherwise an error message should occur that the code number does not exist.

If you base your form on the table, and the table looks you say it does, you could just use the ordinary (access) search function to do what you want.

I appologize if I did not understand the question.

Fuga.
 
Thanks for your comments Fugga, but this is not what I was lloking for as i have tried this method already and this is also generated code.

Many Thanks
 
I´m not sure this will work, but here we go.

As the on_click event of your button:

Code:
dim strcode as string, strdescription as string
dim rstable as DAO.recordset

strcode = me.textbox1
set rstable = currentdb.openrecordset("select * from table1 where field1 = " & strcode)
strdescription = rstable.fields("field2")
Me.textbox2 = strdescription
Me.refresh


Fuga.
 
Create a combo box on the form using the Wizard. On the Wizards first screen select the 3rd item, "Find a record..." Finish the Wizard. Now you can start typing in the number you want and when you find it that number and the description will be displayed in your Text boxes assuming they are bound to the fields in the table....

hth,
Jack
 
Last edited:

Users who are viewing this thread

Back
Top Bottom