Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Link VB text box to Data Set

Status
Not open for further replies.

pamw85

Computer
Joined
Mar 5, 2006
Messages
1
Location
GB
Hello!

I am trying to take the data from an edit box, edt1.text and enter it into a field Product ID in my datagrid. This will then go to my Access database. I can do the second part but not the first.

I have added in a data binding link from the edit box to the field, so when i type the data manually it will update in the database. I am thinking of using an SQL statement to do this but I can't seem to get it correct....

Any help would be great...

Pam
 
The data in your TextBox called ed1 are written as a character string.The max length is about 32000 characters (probably 2^15, I have not counted).In a VBa you can move this character string into a string variable, like a$=ed1.text.
With len(a$) you get the length of the string in ed1.
Alternativelly you assign to the pointer to the start point of the character string in ed1 a very large value, larger then the last character in your string, like
Let ed1.SelStart=30000
in this case it will give you back the position of the last character and you can intercept the result easily by
lastcharacter=ed1.SelStart
Again you get the length of the character string.
Maybe there is a more elegant way but I do not know it.
From now on it is routine: you should find separators among data fields( space? comma?...?)and move each group of characters that represent a single data into whatever cell you wish.
m777182
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top