Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Wanted Visual Basic Guru


  • Please log in to reply
9 replies to this topic

#1 donuteh

donuteh

  • Members
  • 25 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:100 Mile House
  • Local time:06:26 AM

Posted 05 January 2010 - 12:46 PM

I'm new to Visual basic and I'm sure this is something I should already know. I'm creating a Database to keep track of Deviation reports, each Deviation report has a reference number. (The reference number is located in Column A in case that helps) I have a user form that will help the user to fill the information into the correct places. When I enter the reference number into the text box and hit the command button (I called it "Find") it fills out the user form with all information that is already available. however, what I'm trying to do is be able to update it. I would like to select the row that contains the selected reference number and when I hit update, I'd like to overwrite the whole row.
So far I have it acting the same as my new deviation report button. I'm sure it's something as simple as creating a couple variables and telling it what to do with them, but I'm just not seeing it.

Any help would be greatly appreciated.
Thank you in advance,

:thumbsup: Dirk
The speed of sound is defined by the distance from door to computer divided by the time interval needed to close the media player and pull up your pants when your mom shouts "OH MY GOD WHAT ARE YOU DOING!!!"

BC AdBot (Login to Remove)

 


#2 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:08:26 AM

Posted 05 January 2010 - 01:05 PM

Is your 'database' just a text file?

EDIT: Err, just to be clear, I do not consider myself a 'guru'. What you are asking sounds trivial; I just need some clarification.

#3 Keithuk

Keithuk

  • Members
  • 960 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:03:26 PM

Posted 06 January 2010 - 08:20 AM

I'm new to Visual basic and I'm sure this is something I should already know.


Visual basic is a misconception.

Which version are you using VB6 or VB.Net? VB keywords are the only link between them.

If your new to VB then it looks like VB.Net 2005, 2008 or 2010? :thumbsup:

Keith

Windows ME (spare computer)
Windows XP 2002 Professional SP3 (desktop computer)
Windows 7 Professional SP1 32bit (laptop computer)

Windows 8 64bit spare drive for laptop computer


#4 donuteh

donuteh
  • Topic Starter

  • Members
  • 25 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:100 Mile House
  • Local time:06:26 AM

Posted 06 January 2010 - 09:27 AM

My Database is an Excel file, I'm using VB 6.5 which seems to be integrated as part of Excel 2007. My boss is usually the one doing these things but he's busy so now I'm doing it. I am new to VB (about 2 weeks) so I don't know a whole lot yet.
Thank you for your replies, it's good to know there are people out there who are willing to help a noob like me. :-)
The speed of sound is defined by the distance from door to computer divided by the time interval needed to close the media player and pull up your pants when your mom shouts "OH MY GOD WHAT ARE YOU DOING!!!"

#5 Keithuk

Keithuk

  • Members
  • 960 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:03:26 PM

Posted 06 January 2010 - 12:50 PM

My Database is an Excel file, I'm using VB 6.5 which seems to be integrated as part of Excel 2007.


Thats another misconception there has never been a VB6.5 but I think we are on the older VB track. :thumbsup:

Keith

Windows ME (spare computer)
Windows XP 2002 Professional SP3 (desktop computer)
Windows 7 Professional SP1 32bit (laptop computer)

Windows 8 64bit spare drive for laptop computer


#6 donuteh

donuteh
  • Topic Starter

  • Members
  • 25 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:100 Mile House
  • Local time:06:26 AM

Posted 06 January 2010 - 02:25 PM

lol ok you got me, it actually says version 6.5.1040 I'm not really sure what that's supposed to mean but there you have it, version 6 followed by a bunch of random numbers. I got it from the Help menu/ about Microsoft Visual Basic... probably doesn't actually mean anything, I sometimes think that the only thing some of the Microsoft updates to is update that number. You think??? :thumbsup:
The speed of sound is defined by the distance from door to computer divided by the time interval needed to close the media player and pull up your pants when your mom shouts "OH MY GOD WHAT ARE YOU DOING!!!"

#7 donuteh

donuteh
  • Topic Starter

  • Members
  • 25 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:100 Mile House
  • Local time:06:26 AM

Posted 07 January 2010 - 05:18 PM

Never mind, I figured it out, it took me little while but I did it, now I'm proud of myself. :-) Thanks to anyone who may have been working on this for me, I'm still interested to see what other people come up with. here's mine for anyone who might have the same question I had.

Sub Update()

Dim lrow As Long, x As Integer
Dim rng As Range, cell As Range
Set rng = Range("A2:A" & Cells(65536, "A").End(xlUp).Row)
If (Application.WorksheetFunction.CountIf(rng, TextBox25.Value) >= 1) Then
For Each cell In rng
If (cell.Value = TextBox25.Value * 1) Then

'Selects cell at beginning of required row
lrow = cell.Row And cell.Select
  
'places information from text fields into the appropriate cells
ActiveCell.Offset.Value = TextBox9.Value
ActiveCell.Offset(0, 1).Value = TextBox2.Value
ActiveCell.Offset(0, 2).Value = TextBox1.Value
ActiveCell.Offset(0, 3).Value = TextBox3.Value
ActiveCell.Offset(0, 4).Value = TextBox4.Value
ActiveCell.Offset(0, 5).Value = TextBox5.Value
ActiveCell.Offset(0, 6).Value = TextBox6.Value
ActiveCell.Offset(0, 7).Value = ComboBox1.Value
ActiveCell.Offset(0, 8).Value = TextBox7.Value
ActiveCell.Offset(0, 9).Value = TextBox8.Value
ActiveCell.Offset(0, 10).Value = TextBox10.Value
ActiveCell.Offset(0, 11).Value = TextBox11.Value
ActiveCell.Offset(0, 12).Value = TextBox12.Value
ActiveCell.Offset(0, 13).Value = TextBox13.Value
ActiveCell.Offset(0, 14).Value = TextBox14.Value
ActiveCell.Offset(0, 15).Value = TextBox15.Value
ActiveCell.Offset(0, 16).Value = TextBox16.Value
ActiveCell.Offset(0, 17).Value = TextBox17.Value
ActiveCell.Offset(0, 18).Value = TextBox18.Value
ActiveCell.Offset(0, 19).Value = TextBox19.Value
ActiveCell.Offset(0, 20).Value = TextBox20.Value
ActiveCell.Offset(0, 21).Value = TextBox21.Value
ActiveCell.Offset(0, 22).Value = TextBox22.Value
ActiveCell.Offset(0, 23).Value = TextBox23.Value
ActiveCell.Offset(0, 24).Value = TextBox24.Value
ActiveCell.Offset(0, 25).Value = TextBox27.Value
ActiveCell.Offset(0, 26).Value = TextBox28.Value
ActiveCell.Offset(0, 27).Value = TextBox29.Value
ActiveCell.Offset(0, 28).Value = TextBox30.Value
ActiveCell.Offset(0, 29).Value = TextBox31.Value
ActiveCell.Offset(0, 30).Value = TextBox32.Value
ActiveCell.Offset(0, 31).Value = TextBox33.Value
ActiveCell.Offset(0, 32).Value = TextBox34.Value
ActiveCell.Offset(0, 33).Value = TextBox35.Value
ActiveCell.Offset(0, 34).Value = TextBox36.Value
ActiveCell.Offset(0, 35).Value = TextBox37.Value
ActiveCell.Offset(0, 36).Value = TextBox38.Value
ActiveCell.Offset(0, 37).Value = TextBox39.Value
ActiveCell.Offset(0, 38).Value = TextBox40.Value
ActiveCell.Offset(0, 39).Value = TextBox41.Value
ActiveCell.Offset(0, 40).Value = TextBox42.Value
ActiveCell.Offset(0, 41).Value = TextBox43.Value
ActiveCell.Offset(0, 42).Value = TextBox44.Value
ActiveCell.Offset(0, 43).Value = TextBox45.Value
ActiveCell.Offset(0, 44).Value = TextBox46.Value
ActiveCell.Offset(0, 45).Value = TextBox48.Value
ActiveCell.Offset(0, 46).Value = TextBox49.Value
ActiveCell.Offset(0, 47).Value = TextBox45.Value
ActiveCell.Offset(0, 48).Value = TextBox51.Value
ActiveCell.Offset(0, 49).Value = TextBox52.Value

Exit For
End If
Next cell
Else
MsgBox ("No Match Found")
End If

End Sub

The speed of sound is defined by the distance from door to computer divided by the time interval needed to close the media player and pull up your pants when your mom shouts "OH MY GOD WHAT ARE YOU DOING!!!"

#8 Romeo29

Romeo29

    Learning To Bleep


  • Members
  • 3,194 posts
  • OFFLINE
  •  
  • Gender:Not Telling
  • Location:127.0.0.1
  • Local time:09:26 AM

Posted 07 January 2010 - 10:23 PM

For those who did not understand like me, donuteh is talking about VBA included in Microsoft Office products.

#9 Keithuk

Keithuk

  • Members
  • 960 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:03:26 PM

Posted 08 January 2010 - 07:56 AM

Thanks Romeo29 this topic is getting as clear as mud by the day.

When I first read this it was talking about databases I assumed Access but that code is using an Excel Sheet. So is this a combination of both of them Dirk? :thumbsup:

Keith

Windows ME (spare computer)
Windows XP 2002 Professional SP3 (desktop computer)
Windows 7 Professional SP1 32bit (laptop computer)

Windows 8 64bit spare drive for laptop computer


#10 donuteh

donuteh
  • Topic Starter

  • Members
  • 25 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:100 Mile House
  • Local time:06:26 AM

Posted 08 January 2010 - 09:01 AM

Oh, sorry, my bad. Yes, I am using a database created in Excel, I've never worked with Access because my boss is afraid of it, which is weird because he used to do a lot of work with it when he worked for Canadian Airlines.
The speed of sound is defined by the distance from door to computer divided by the time interval needed to close the media player and pull up your pants when your mom shouts "OH MY GOD WHAT ARE YOU DOING!!!"




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users