PDA

View Full Version : Database Userform VBA Code Help Please



matty25
11-02-2008, 04:03 PM
Q1. How would i go about setting up a new userform to view the records, say with 12 textboxes (named after columns A-L) with 3 cmdButtons - one button for "Next Record", one for "Previous Record" and one for "Close" (to close form). The Next and Previous buttons would be used for navigating next and previous records in supplier database.

Q2. I also need to set up a separate userform to be able to Amend and Delete existing data in the database. I already have a userform setup for Adding new data.

Any help, suggestions, and hopefully solutions will be much appreciated.

Regards,

Matt :help

GTO
11-02-2008, 06:14 PM
Greetings matty25,

Well welcome! I just joined VBAX recently myself, though I had been visiting the forum for a couple of years. You will find that there are some mighty nice folks here, and even when I was just "watching" and learning as a guest, I would see that folks would make every efforts to come up with a solution to all sorts of problems. Anyways, I'm sure you'll like it here, and wanted to be the first to say "Howdy".

As to your current project:

As you are trying to populate the list box with only the results of a search, I can see why RowSource wouldn't work right off. That said, there is a 10 column limit on an unbound listbox.


...Deleted...

Cross posted at: http://www.ozgrid.com/forum/showthread.php?t=117308

Matty or Matt:

You cross posted your very first thread! Please do not waste the time of those trying to help you by having them repeating what someone else has already said, or duplicating efforts.

Mark

GTO
11-02-2008, 09:37 PM
Also cross-posted at:

http://www.mrexcel.com/forum/showthread.php?t=350805

Mark

matty25
11-03-2008, 11:40 AM
I'm sorry if this has offended anyone in any way..

Regards, Matt

lucas
11-03-2008, 11:59 AM
Matt, It is a matter of courtesy. If you post in several locations and someone has already provided a solution then it would be nice to know before investing any time in helping you find a solution....

Click here (http://www.excelguru.ca/node/7) for a detailed explaination. Just provide the links and all will be well although some folks will still overlook your thread if they know you are posting in multiple forums instead of trying one forum until you no longer are getting the help you need.

matty25
11-03-2008, 12:16 PM
Okay Lucas, point taken.

I will agree to post in this forum alone unless i cant get the answer/help i need.

Regards, Matt

CreganTur
11-03-2008, 12:19 PM
Okay Lucas, point taken.

I will agree to post in this forum alone unless i cant get the answer/help i need.

Regards, Matt

Be sure to read the article that lucas put in his post. It's not a sin to cross-post, but if you do cross-post over multiple forums then you need to include a link to your cross-post for courtesy's sake.

BTW, welcome to the forum- it's always good to have new members! I hope this first experience doesn't color your view of VBAX too much; you'll find this to be a very friendly and informative environment filled with a lot of knowledgable people.

GTO
11-03-2008, 05:27 PM
Hi Matt,

Hopefully my response was not overly blunt, but maybe I could have worded it more graciously.

Welcome. Did you ever get a satisfactory 12 column listbox accomplished?

Mark

matty25
11-04-2008, 12:04 PM
Hi Matt,

Hopefully my response was not overly blunt, but maybe I could have worded it more graciously.

Welcome. Did you ever get a satisfactory 12 column listbox accomplished?

Mark

Thanks GTO, yeah i managed to get it to work in the end.

phendrena
11-05-2008, 04:12 AM
Hi,

I was wondering if you could post a copy of the workbook as i'm looking to do something similar and would like to view a working example.

I have also posted in your thread on MrExcel : http://www.mrexcel.com/forum/showpost.php?p=1736247&postcount=3
In that thread i have asked mikerickson who helped with your query if he could help me expand a little on what you have done :


Hi,

I'm also interested in the above and have setup a really quick worksheet (sheet1) and created a basic userform with :

Textbox1
Listbox1
CommandButton1

When i click the command button assigned to butFindAll i get the following error :

Runtime error '13'
type mismatch

the debugged then highlights : ArrayOfMatchingRows = Application.Transpose(DataArray)

In column A i have my Dates, displayed as dd/mm/yyyy (UK format).

Now, if i change the range that the code looks through to D:D which contains a Dealer Code rather than a date then the listbox is then populated but with the data from column D onwards.

So...

1) Why is the date causing a problem?

2) How can I still use column D (or others) as my search criteria and still have all the data in the listbox?

3) How can i restrict what data it shows in the listbox, for example perhaps just columns A, D, F & H?

-----------------

You also mentioned that it would be possible to create on this userform a way to edit the data and have it update what has already been entered.
Would you be able to advise how this can be done?
I weould prefer to use one userform that has the search and editing functions in one rather than two forms or forms with multiple pages if at all possible.

Many Thanks,


Thanks,

matty25
11-05-2008, 11:26 AM
Hi, i posted my workbook in this post, feel free to download:

http://vbaexpress.com/forum/showthread.php?t=23290

Regards, Matt