Page 2 of 2 FirstFirst 12
Results 41 to 52 of 52

Thread: [RESOLVED] How to set current date..??

  1. #41
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [RESOLVED] How to set current date..??

    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.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  2. #42

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Posts
    185

    Re: [RESOLVED] How to set current date..??

    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...

    Thank you for your kindness...

    Jennifer

  3. #43

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Posts
    185

    Re: [RESOLVED] How to set current date..??

    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:
    1. Private Sub CommandButton3_Click()
    2.  
    3. Dim con As ADODB.Connection
    4.     Set con = New ADODB.Connection
    5.     con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\exercise.mdb"
    6.     If Not TypeName(rst) = "Nothing" Then
    7.         'something
    8.         Dim ItemCode As String
    9.          
    10.          rst.MoveFirst
    11. Do While rst.EOF = False
    12.     ItemCode = Trim$(cmb_item)
    13.  
    14.     If ItemCode <> "" Then
    15.         ' Restrict/filter the recordset by the selected Item_Code
    16.         Debug.Print "Item_Code=" & ItemCode
    17.         rst.Filter = "Item_Code = " & ItemCode
    18.    
    19.     End If
    20.    
    21.     If UserForm1.txtqty.Text = rst.Fields("Item_Code").Value Then
    22.    
    23.     Exit Do
    24.     rst.MoveNext
    25. Loop
    26.         If rst.State = adStateOpen Then
    27.             'open
    28.             rst.Close
    29.             Set rst = Execute_SQL_ReturnRecordSet("Select * from Item", , _
    30.         "C:\exercise.mdb")
    31.         Else
    32.             'closed
    33.             Set rst = Execute_SQL_ReturnRecordSet("Select * from Item", , _
    34.         "C:\exercise.mdb")
    35.         End If
    36.     Else
    37.         'nothing
    38.         Set rst = Execute_SQL_ReturnRecordSet("Select * from Item", , _
    39.         "C:\exercise.mdb")
    40.     End If
    41.     TextBox3.Text = rst.Fields("Qty")
    42.  
    43. 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...

  4. #44

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Posts
    185

    Re: [RESOLVED] How to set current date..??

    Hi Rob,

    Sorry...would you like to help me to find the code please..???

    Thanks very much for your kindness..

    Jennifer

  5. #45

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Posts
    185

    Re: [RESOLVED] How to set current date..??

    Please help me with this codes...only one step to finish...thanks a lot,

    Jennifer

  6. #46
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [RESOLVED] How to set current date..??

    You need to compare the item id with the item id and not qty.
    VB Code:
    1. If UserForm1.txtqty.Text = rst.Fields("Item_Code").Value Then
    2.  
    3. 'Should be - Item_Code or whatever the txt name is.
    4. If UserForm1.txtItem_Code.Text = rst.Fields("Item_Code").Value Then
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  7. #47

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Posts
    185

    Re: [RESOLVED] How to set current date..??

    Hi,

    I tried but still error:

    VB Code:
    1. Private Sub cmd_CheckCurrent_Click()
    2.  
    3. Dim con As ADODB.Connection
    4.     Set con = New ADODB.Connection
    5.     con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\exercise.mdb"
    6.     If Not TypeName(rst) = "Nothing" Then
    7.         'something
    8.         Dim ItemCode As String
    9.                    rst.MoveFirst
    10. Do While rst.EOF = False
    11.     ItemCode = Trim$(cmb_item)
    12.  
    13.     If ItemCode <> "" Then
    14.         ' Restrict/filter the recordset by the selected Item_Code
    15.         Debug.Print "Item_Code=" & ItemCode
    16.         rst.Filter = "Item_Code = " & ItemCode
    17.    
    18.     End If
    19.         If UserForm1.cmb_item.Text = rst.Fields("Item_Code").Value Then
    20. Loop
    21.     rst.MoveNext
    22.  
    23.         If rst.State = adStateOpen Then
    24.             'open
    25.             rst.Close
    26.             Set rst = Execute_SQL_ReturnRecordSet("Select * from Item", , _
    27.         "C:\exercise.mdb")
    28.         Else
    29.             'closed
    30.             Set rst = Execute_SQL_ReturnRecordSet("Select * from Item", , _
    31.         "C:\exercise.mdb")
    32.         End If
    33.     Else
    34.         'nothing
    35.         Set rst = Execute_SQL_ReturnRecordSet("Select * from Item", , _
    36.         "C:\exercise.mdb")
    37.     End If
    38.  
    39.  
    40. End Sub

  8. #48
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [RESOLVED] How to set current date..??

    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?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  9. #49

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Posts
    185

    Re: [RESOLVED] How to set current date..??

    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

  10. #50
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [RESOLVED] How to set current date..??

    We have a Database FAQ located here - http://www.vbforums.com/showthread.php?t=337051
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  11. #51

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Posts
    185

    Re: [RESOLVED] How to set current date..??

    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...

  12. #52

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Posts
    185

    Re: [RESOLVED] How to set current date..??

    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....

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width