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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Determining the record showing in a form

Status
Not open for further replies.

tomhughes

Vendor
Aug 8, 2001
233
US
I have a form(named "Configure") which is bound to a table(named "Table1"). The field in the table that is showing in the text box of the form is called "textData". I am trying to strip the text in the forms text box of certain parts, and modifying them. I'm not sure how to go about this. Shouldn't I change the table data, and update the form. If so, how do I refer to the record that is showing in the text box ?
 
Tom,

It might help if you provide a couple of BEFORE and AFTER examples of the data that you are trying to change via the form. That will help to clarify the problem.

Cheers,
Steve
 
Tom, if the text box is bound to your "CONFIGURE" field, you don't have to worry about referring to the record showing on the form - it IS the record showing on the form. As long as you don't move off that record, any change made to the bound object will be reflected back to the table object.

Now, in terms of what you want to to do that value, you will want to research the string manipulation functions, I guess.

LEFT, MID, RIGHT, INSTR etc...

There are two ways to argue with a woman - neither one works.
Another free Access forum:
More Access stuff at
 
The text that is showing in the form is text that will be inserted into a web page. It has markup language in it. Example <p><sample> etc.. What I am doing is cahnging the markup language to reflect different fonts. The first thing I must do is to check the text to determine if it has any markup language present, strip that, and insert any changes to it. I have the program already written to strip all markup language from it. Right now I can only deal with the first record since my code in VBA is :

rst.Index = &quot;PrimaryKey&quot;

which evidently looks at the first record. As I step through the records, the code does not. Since I am writing to the table and not the form, the code needs to know which record I am on in the form. Could I write to the form, and have it then change the table? Either way I need a way to change each record in the table.
 
Tom, I'm not sure I understand what you mean by &quot;write to the form and have it change the table&quot; - the form IS the table. Well, not really. It's SHOWING what's in the table. Bound fields on a form automatically are posted to the underlying recordsource if you change the displayed data and commit the change (record movement, form closure, explicit SAVE, etc).

Also, your reference to the first record and the use of the INDEX of the table seems confused. The index setting merely determines which of several possible indices your code will use for record navigation. It sounds like you might be opening the table and refencing the first record, but not doing anything to MOVE to subsequent records.

I think you're overcomplicating this process. Display your records on a form (single or continuous mode) and have a command button or whatever that runs your markup-language stripping routine for the current record:

Sub btnFixIT_click()
if Instr(me!configure, &quot;<&quot;) > 0 then
{ strip out the markup tags }
End if
end sub

If you wanted to do this procedurally, you'd do something like this in a sub or function:

-----------------------------------------
Sub FixEmAll()
dim rst as recordset
set rst = CurrentDB.OpenRecordset(&quot;Your table here&quot;)

With rst
while NOT .BOF
do
.moveNext
if Instr(!Configure, &quot;<&quot;) > 0
{ strip out markup tags )
end if
.Update
Loop
.Close
End With

set rst = Nothing
----------------------------------
That may not be the exact syntax but it should provide you with the idea of what it is you want to do.

BTW, there's no reason to worry about an index if you're navigating through every record in sequence.

HTH

















There are two ways to argue with a woman - neither one works.
Another free Access forum:
More Access stuff at
 
A lot of what I asked was confusing because I am just learning, especialy about the index.

OK - I see that changing the form changes the table. Now I am trying to determine what the combo boxes are set to, so I can add their appropriate data to the string.

I have used the &quot;ListIndex&quot; property, but now I am trying to use the &quot;Selected&quot; property of the combo box.



 
Don't worry about the confusion - Access (or any reasonably powerful DBMS) can be a real bear to get around in when you're first starting out. It'll come.

Also, you can refer to the value selected in a combo box by simply refering to the combo box name. So, for example, if you have a c/b with the names of the 50 states, and you drop it down and select &quot;NJ&quot;, if you refer to
&quot;ComboBox1&quot;, you'll get &quot;NJ&quot;.

So a chunk of code might look something like this:

txtVariable = me!ComboBox1 & &quot; foo &quot; & me!ComboBox2

We won't get into multiple COLUMN combo boxes and the BOUND column unless you want to...

Jim



There are two ways to argue with a woman - neither one works.
Another free Access forum:
More Access stuff at
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top