Your going to have to move the rst recordset to whatever row your focussing on. Your going to have to loop until your rst is on the table cell that has the focus or is selected.
Printable View
Your going to have to move the rst recordset to whatever row your focussing on. Your going to have to loop until your rst is on the table cell that has the focus or is selected.
Please...show me the code (the corrected codes please)..because that is better for me to learn....I am just a novice user and try to learn how to make it...because there is no on the net and also on the bookas far as I did the search...I only hope from this forum.....so, please me the codes if you dont mind....anyway, this is also for everybody in this forum who would like to create kind of this form...:) :thumb:
Thank you for your kindness...
Jennifer ;)
Dear Experts,
I really need your help with this codes...I tried many time and this is my last codes but still wont work...please help me:
VB Code:
Private Sub CommandButton3_Click() Dim con As ADODB.Connection Set con = New ADODB.Connection con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\exercise.mdb" If Not TypeName(rst) = "Nothing" Then 'something Dim ItemCode As String rst.MoveFirst Do While rst.EOF = False ItemCode = Trim$(cmb_item) If ItemCode <> "" Then ' Restrict/filter the recordset by the selected Item_Code Debug.Print "Item_Code=" & ItemCode rst.Filter = "Item_Code = " & ItemCode End If If UserForm1.txtqty.Text = rst.Fields("Item_Code").Value Then Exit Do rst.MoveNext Loop If rst.State = adStateOpen Then 'open rst.Close Set rst = Execute_SQL_ReturnRecordSet("Select * from Item", , _ "C:\exercise.mdb") Else 'closed Set rst = Execute_SQL_ReturnRecordSet("Select * from Item", , _ "C:\exercise.mdb") End If Else 'nothing Set rst = Execute_SQL_ReturnRecordSet("Select * from Item", , _ "C:\exercise.mdb") End If TextBox3.Text = rst.Fields("Qty") End Sub
I am very appreciate if you make a correction for this code to make it run...by only giving advice could not solve the problem because I know the logic BUT i dont know what should I put on first (the code) and what next and what next...before I see the sample...example...etc...about how to write its codes...so, please be understood.....
Thanks a lot for your kind helps... :confused:
Hi Rob,
Sorry...would you like to help me to find the code please..???
Thanks very much for your kindness..
Jennifer :(
Please help me with this codes...only one step to finish...thanks a lot,
Jennifer :(
You need to compare the item id with the item id and not qty.
VB Code:
If UserForm1.txtqty.Text = rst.Fields("Item_Code").Value Then 'Should be - Item_Code or whatever the txt name is. If UserForm1.txtItem_Code.Text = rst.Fields("Item_Code").Value Then
Hi,
I tried but still error:
VB Code:
Private Sub cmd_CheckCurrent_Click() Dim con As ADODB.Connection Set con = New ADODB.Connection con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\exercise.mdb" If Not TypeName(rst) = "Nothing" Then 'something Dim ItemCode As String rst.MoveFirst Do While rst.EOF = False ItemCode = Trim$(cmb_item) If ItemCode <> "" Then ' Restrict/filter the recordset by the selected Item_Code Debug.Print "Item_Code=" & ItemCode rst.Filter = "Item_Code = " & ItemCode End If If UserForm1.cmb_item.Text = rst.Fields("Item_Code").Value Then Loop rst.MoveNext If rst.State = adStateOpen Then 'open rst.Close Set rst = Execute_SQL_ReturnRecordSet("Select * from Item", , _ "C:\exercise.mdb") Else 'closed Set rst = Execute_SQL_ReturnRecordSet("Select * from Item", , _ "C:\exercise.mdb") End If Else 'nothing Set rst = Execute_SQL_ReturnRecordSet("Select * from Item", , _ "C:\exercise.mdb") End If End Sub
If its not matching with the value in the database you need to check the values manually. Do a Debug.Print of each value to be compared, combo and database. If the combo's value has no trailing spaces then it should be jsut the word. If the value in the database, more then likely, has trailing spaces then the two items will not match.
Also what is the type for the db field?
Hi,
I am using ADO, and the database is Ms Access........is there any tutorial/how to now the codes look like for this kind of form in Ms Words please...???...like auto increment number, line this kind questions I asked you...etc????..Is possible to have a look by looking from Macro record..???
Thanks,
Jennifer :)
We have a Database FAQ located here - http://www.vbforums.com/showthread.php?t=337051
Hi Rob,
I read trough all related FAQ but there is no answer or example there....especially for "Check Current Stock"...is it possible for me to know that codes please...because I intent to put all codes and file once the form is already done in VBFORUMS tutorial...;)
Hi Rob,
Sorry.. I just wanna ask...why dont you just fix that codes please..???...That is not only for me...Because you could post this issue of Word VBA on the tutorial so everybody can see it and learn from codes how to build that form, etc...and this forum will be the total solution forum with complete example...since other forums are not so good as VBFORUMS....;)