Go Back   PCMech Forums > Help & Discussion > Web Design / Development

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 03-05-2002, 02:06 AM   #1
Member (9 bit)
 
jalbes's Avatar
 
Join Date: Jul 2000
Posts: 257
Cool HackinCowboy

Wow, I couldn't thank you enough. I opened up my e-mail and I nearly @#$& my pants. I utilized your code but now I face a new hurdel that I'm sure that you can help me leap over.

Heres my dilema:
when I select an address or unit number and press find, I want all the information to show up in a new form. So I know that I'll need a module. In the module I inserted:
Option Explicit
Dim dbTenant As Database
Dim rsTenant As Recordset
Dim rsTemp As Recordset

But is there a specific command that I use to access the module, or does it already assume that all the forms are linked?

Like with this line: txtUnit.Text = rsTemp("Unit Number") in your program it pastes the data from the temp recordset to the "Unit" text box.
But assume that the "Unit" text box is on another form, what line do I use to paste to that new form?

If you don't understand, I don't blame you, So I put up what I have so far so you can see what I'm talking about.

Thanx,
Shaun
jalbes is offline   Reply With Quote
Old 03-05-2002, 07:29 AM   #2
Member (10 bit)
 
Join Date: Apr 2001
Location: Michigan
Posts: 850
Send a message via ICQ to HackinCowboy
I checked over your code so far. First, when using a module, you declare variables as Public instead of Dim. Also in your form, you do not need to re-declare the variables at the top. I would also declare Address and Unit as globals. This way when you assign them values from one form, those values will still exist in another. I've made some changes in your code to show you what I mean.
Good Luck,
~HC
Attached Files
File Type: zip turret database.zip (10.7 KB, 41 views)
HackinCowboy is offline   Reply With Quote
Old 03-05-2002, 02:25 PM   #3
Member (9 bit)
 
jalbes's Avatar
 
Join Date: Jul 2000
Posts: 257
where you stated "you declare variables as Public instead of Dim." I totally forgot all about that. Someone else on another forum told me that a while back. Ooops! LOL

And I knew that I didn't have to re-declare the variables at the top. I had just left them there from when I used your code and was trying to figure out the module.

But when you said "I would also declare Address and Unit as globals. This way when you assign them values from one form, those values will still exist in another." I'm a little unsure what you meant. So whats the difference between Public and Global?

Thanx again.
jalbes is offline   Reply With Quote
Old 03-05-2002, 02:47 PM   #4
Member (10 bit)
 
Join Date: Apr 2001
Location: Michigan
Posts: 850
Send a message via ICQ to HackinCowboy
Sorry that was kind of misleading. Global just deals with the level of availibility a variable has. Global is the highest. Public means that it can be accessed by any other part of your program. So to keep it simple, Public and Global are the same. When you declare variables you just say "Public variable name As type"
HackinCowboy is offline   Reply With Quote
Old 03-06-2002, 01:27 AM   #5
Member (9 bit)
 
jalbes's Avatar
 
Join Date: Jul 2000
Posts: 257
Just when you thought you got rid of me...

Ok, so here I am, inserting code:
Set rsTemp = dbTenant.OpenRecordset("SELECT * From Tenant WHERE (Address ='" & sAddress & "')")
txtAddress = rsTemp("Address")
txtUnit = rsTemp("Unit")
txtCity = rsTemp("City")
txt... you get the idea...

And I decide to try the program, I select an address from the combobox, press find and then I suddenly get an error stating:
Runtime error '94':
Invalid use of Null

So I press debug to explore further and the line:
txtCompany = rsTemp("Company")
is highlighted. So I double check for spelling, correctness. Then I decide to open the table in access to see if the problem lays within there. The only difference that I found that could be associated is that the "Company" column is empty or "Null".

Therefore I believe I need to make it so that certain text boxes aren't required and can show up empty if my batabase feild is also empty. Any suggestions?
jalbes is offline   Reply With Quote
Old 03-06-2002, 07:32 AM   #6
Member (10 bit)
 
Join Date: Apr 2001
Location: Michigan
Posts: 850
Send a message via ICQ to HackinCowboy
Try going into your database and set the Company Field property Allow Zero Length String to YES. This will allow you to add a record without having to enter in a value for this field. Anytime you have a text field that may not always have values entered in them, set them to Allow Zero Length String
Hope this fixes it. If not I can look more into it.
~HC
HackinCowboy is offline   Reply With Quote
Old 03-08-2002, 03:36 PM   #7
Member (9 bit)
 
jalbes's Avatar
 
Join Date: Jul 2000
Posts: 257
Exclamation Still no go

really weird.

I tried what you sayed, and it was already set that way from when I created the DB file. I even converted the file from access '97 to 2000 and still no go.
I tried making a default formatting thing in access so when you see the "Date" it would show up as "dd/mm/yyyy;;*". Still wouldn't work.

Argh...!

Any ideas?
jalbes is offline   Reply With Quote
Old 03-09-2002, 07:34 PM   #8
Member (9 bit)
 
jalbes's Avatar
 
Join Date: Jul 2000
Posts: 257
LOL, stupid me...

Well I finally figured something out for my self, LOL.
I was getting really disgruntled so I strolled over to Chapters and read a few VB books. 5 hours later I decided to leave (without purchasing a book!) and felt even less intelligent from when I first went in. So I went over to VB-World and did a search. I looked through a few threads and I finally found one that caught my attention. Someone had the same problem and the fix was as simple as this:

What I had before:
txtPostalCode = rsTemp ( "PostalCode" )

And here was the fix:
txtPostalCode = rsTemp ( "PostalCode" ) & ""

Thanx for your help anyway.
Shaun
jalbes is offline   Reply With Quote
Reply

Bookmarks

Still Need Help? Type Your Keywords Here:


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 07:52 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 PL2