Hi everybody!!!
Hope u are going to understand me. Coming from Croatia. I have made one userform with few butons, have searched all around WWW to find some useful tutorials on how to..? Have it all done and works perfect. Just few text boxes and few buttons. Now i go bit further and want to add nav buttons to be able to cycle thru records and update individual records. Have found one nice tutorial but part of code don t work and i can t figure it way. Maybe u guys and girls can help me to solve this problem. So far i got record shown on my form when initialize, button First and Last record working but can t get Next, Prew and Update buton to work. On end i made same sheet with same data and same form as in tutorial and u can see it on:
http://msdn.microsoft.com/en-us/libr...ice.11%29.aspx
Part of Next code should be all most the same as for Prew and i wrote this:
Can anybody see what s wrong. I am using Excel 2007. Thank u for time taken to read my post. Hope to get an answer.Private Sub CommandButton3_Click() Dim r As Long If IsNumeric(RowNumber.Text) Then r = CLng(RowNumber.Text) r = r + 1 If r > 1 And r <= LastRow Then RowNumber.Text = FormatNumber(r, 0) End If End If End Sub
I wish u all marry christmas and happy new year!!!!
Last edited by gopavic; 12-28-2011 at 02:56 PM.
Hi gopavic,
I would suggest you to upload the sample workbook with user form to enable forum to help you better. Thanks.
Regards,
DILIPandey
<click on below 'star' if this helps>
DILIPandey
+919810929744
dilipandey@gmail.com
Moderator Bump.
Please leave a message after the beep!
Ok here....
This is my simple workbook with two sheets. When u open Workbook switchboard form is displayed and forms on switchboard are working one. There is another one named "frmTest" and with that one i am coming good for. I got my cmdNav buttons now working. Maybe somebody can look on it to see if there is beter way to write the code and let me know. Next problem i got now is MsgBox i defined in Privet Sub GetData. It says Write number but on Croatian "Upisite redni broj". When i hit Add "Dodaj on Croatian" button everything is fine but when i hit Save "Spremi" work is done and msgBox comes up. That MsgBox is related to RowNumber. RowNumber is txt field between Nav butons in witch u can write record number to be displayed in form. Now how i can get rid of it on hiting Save buton?
My Workbook:
I got rid of msg displaying when i hit "Spremi" button it is Save button. Now how? This way!I took RowNumber text box to side and have made it unvisible. I drow other text box and name it
txtNavButons. Then i wrote in Private Sub GetData() foloving
and i delete it part with "If Then MsgBox" so my new code for part of geting data to my form looks like folowing:txtNavBox.Text = Cells(r, 1)
Now i cant write number of record to be displayed buut who cares i got working Nav buttons...Private Sub GetData() Const LastRow = 20 Dim r As Long If IsNumeric(RowNumber.Text) Then r = CLng(RowNumber.Text) End If If r > 7 And r <= LastRow Then txtRb.Text = Cells(r, 1) txtOpis.Text = Cells(r, 2) txtDatum.Text = Cells(r, 3) cboUplataIsplata.Text = Cells(r, 7) txtNavBox.Text = Cells(r, 1) If Cells(r, 7) = "Uplata" Then txtIznos.Text = Cells(r, 4) Else txtIznos.Text = Cells(r, 5) End If ElseIf r = 1 Then ClearData End If End Sub
I am working further...and thinking
![]()
Last edited by gopavic; 12-29-2011 at 02:51 PM.
Yeeeaaaa......
I got it finally working. One small detail still left. I don t know if it is possible but i will give a try. It s about auto fill random number on the beginning
of adding new record. Well i think i will find out soon!!!!
Next I will translate it on english and upload it so other can play bit around it..... See u soon guys... and girls off cours...![]()
Take a look at the DatabaseForm
Hope that helps.
RoyUK
--------
If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need
For Excel Tips & Solutions, free examples and tutorials why not check out my downloads
New members please read & follow the Forum Rules
Remember to mark your questions Solved and rate the answer(s)
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks