how do i navigate in clinet form? (1 Viewer)

dotan

New member
Local time
Yesterday, 18:07
Joined
Feb 9, 2011
Messages
4
well ill try the best i can to explain whats my problem and because im pretty new in this subject (started to lern it just this year in school) go easy on me
well in my project im runing a robot lab which we fix robot's for clinets (thats what the teacher decided) and i have a clinets form and what i wanted to do is to navigate to a clinet in this form by writing he's id number in a listbox
so i dont know if how i did it was wrong or no but i didnt get any results so can you please guide me how to navigate to a clinet by writing he's name on a listbox on the clinet form?
im sorry for my bad english hope you understand
 

Graham R Seach

New member
Local time
Today, 11:07
Joined
Feb 5, 2011
Messages
4
To display the list in the listbox, enter the correct SQL statement in the listbox's RowSource property (to retrieve the data from its table). To display the selected record on the form when you select an item from the list, add code to the listbox's AfterUpdate event. Something like this:

Dim rs As DAO.Recordset

Set rs = Me.RecordsetClone

rs.FindFirst "clinetid = " & Me!lstMyListbox
If Not rs.NoMatch Then Me.Bookmark = rs.Bookmark

Set rs = Nothing
 

missinglinq

AWF VIP
Local time
Yesterday, 21:07
Joined
Jun 20, 2003
Messages
6,423
To be frank I'm confused. At least thru Access 2003, and I haven't heard of changes in this in 2007/2010, you cannot 'enter' anything in a ListBox. You can, however, in a ComboBox. In fact, Access can do this automatically, using the ComboBox Wizard.

If you haven't already done so, create a form based on your table or query, including all the fields you want displayed. Then simply:Add a combo box to your form.
  1. The Combobox Wizard will pop up
  2. Select "Find a record based on the value I selected in my combobox."
  3. From the table or query the form is based on, click on the field you're searching by (a field that is unique for each record) to move it to the right side.
  4. Hit Next.
  5. Size the column appropriately.
  6. Hit Next.
  7. Name the Combobox.
  8. Hit Finish.
Now you can drop the Combobox down and scroll down to the item to search by, or you can start to enter the item, and the combobox will "autofill" as you type. Hit <Enter> and the record will be retrieved.

The code generated by the Wizard will be similar to the code Graham gave you.

Linq ;0)>
 

dotan

New member
Local time
Yesterday, 18:07
Joined
Feb 9, 2011
Messages
4
im sory i ment textbox
and i understand the i need to use DLookup() but i just dont know how
 

Graham R Seach

New member
Local time
Today, 11:07
Joined
Feb 5, 2011
Messages
4
OK, if you want to enter a clinet ID into a textbox and have that display the apprpriate record, then add something like the following to the textbox's AfterUpdate event:

'Code start
Dim rs As DAO.Recordset

Set rs = Me.RecordsetClone

rs.FindFirst "clinetid = " & Me!lstMyTextbox
If Not rs.NoMatch Then Me.Bookmark = rs.Bookmark

Set rs = Nothing
'Code end

BTW, you don't need DLookup().
 

dotan

New member
Local time
Yesterday, 18:07
Joined
Feb 9, 2011
Messages
4
i cant use somthing that i dont know what it is or what it does i dont know SQL yet....
 

Graham R Seach

New member
Local time
Today, 11:07
Joined
Feb 5, 2011
Messages
4
>>i cant use somthing that i dont know what it is or what it does i dont know SQL yet....

Well, you're supposed to be learning, so learn. If you don't know something, look up Help, start Googling, or actually read a book. We're more than happy to help you, but you have to put in 'some' effort, rather than expecting us to do it all for you. We've actually given you more than we normally would for someone doing schoolwork.
 

dotan

New member
Local time
Yesterday, 18:07
Joined
Feb 9, 2011
Messages
4
>>i cant use somthing that i dont know what it is or what it does i dont know SQL yet....

Well, you're supposed to be learning, so learn. If you don't know something, look up Help, start Googling, or actually read a book. We're more than happy to help you, but you have to put in 'some' effort, rather than expecting us to do it all for you. We've actually given you more than we normally would for someone doing schoolwork.

can you reccomned a book?
 

Graham R Seach

New member
Local time
Today, 11:07
Joined
Feb 5, 2011
Messages
4
You didn't say which version you're using, but Jeff Conrad's site is a good place to start. Jeff is on the Access team at Microsoft. There's also a book list at Luke Chung's site (FMS Inc).

Unfortunately, this forum will not allow me to post links, so you'll have to decipher the following links by removing the spaces.

www . accessmvp.com/JConrad/accessjunkie/resources . html#Books
www . fmsinc.com/toplevel/books . html

You could also try Googling books on Microsoft Access.
 

Users who are viewing this thread

Top Bottom